Replies: 1 comment 6 replies
-
Hi! So what I'd probably do here is
In code, this could be something like final storage = DriftWebStorage.indexedDbIfSupported('my_database');
await storage.open();
final existingData = await storage.restore();
if (existingData == null) {
final dataBytes = await downloadDatabaseAsInYourExample();
await storage.store(dataBytes);
}
await storage.close();
// And then, finally...
return WebDatabase.withStorage(DriftWebStorage.indexedDbIfSupported('my_database')); You can wrap all of this in a |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I'm trying to initialize the sqlite database with web worker connection. Following the code here: https://github.com/simolus3/moor/tree/develop/extras/flutter_web_worker_example
My current implementation without the web worker is to use
InMemoryWebStorage
, when I construct the database I can pass the whole downloaded db into:Is this possible to pass the
dataBytes
when initializing? or any better way to send thedataBytes
to the worker to init the database?Thank you in advance!
Beta Was this translation helpful? Give feedback.
All reactions