cloud_firestore_dart_sqlite 0.1.0
cloud_firestore_dart_sqlite: ^0.1.0 copied to clipboard
The SQLite offline cache of cloud_firestore_dart on the Dart VM, in Flutter and in the browser (WebAssembly on IndexedDB or OPFS), on top of package:sqlite3.
0.1.0 #
First version, for cloud_firestore_dart 0.2 (FirebaseFirestore, Settings,
FirestoreException). The SQLite openers that cloud_firestore_dart 0.1.1 kept in its example/ folder
for apps to copy (sqlite_database.dart, sqlite_database_web.dart, sqlite_opfs_worker.dart),
moved into a package. Their logic is unchanged; what differs:
- One function for every platform:
sqliteOpener({directory, pageCacheMb, sqlite3Wasm, opfsWorker, storagePrefix, lockTimeout})replacessqliteOpener(Directory, {pageCacheMb})on the VM andsqliteWebOpener(...)in the browser.directoryis a pathString(nodart:iotype, so the call compiles on the web);sqlite3Wasmdefaults tosqlite3.wasm. The storage names, the file names and the Web Lock names are the ones of the copied files, so a cache written by them is opened again. openWithMemoryFallbacktakes theOpenDatabaseto try (openDatabase: sqliteOpener(...)) instead ofsqlite3WasmandopfsWorker, and works on every platform.sqlite32.7.3 to 3.x. The VM opener no longer importspackage:sqlite3/open.dart, which 3.x removed, and so no longer overrides the library lookup on Linux. With 3.x the library comes from the build hook ofsqlite3. With 2.x the default lookup ofsqlite3applies: this fixes Flutter on Linux, where the override made the copied opener load the system SQLite instead of the onesqlite3_flutter_libsbundles; a plain Dart program on a Linux machine withoutlibsqlite3.soneeds the override the README shows.close()still callsdispose(), the only close of 2.x (deprecated, not removed, in 3.x).- The OPFS worker is the library
package:cloud_firestore_dart_sqlite/opfs_worker.dart(runOpfsWorker), anddart run cloud_firestore_dart_sqlite:setup_web [web dir]compiles it to<web dir>/sqlite_opfs_worker.jsand prints the URL of the matchingsqlite3.wasm. - The browser-only classes (
SqliteWebDatabase,SqliteOpfsDatabase,inspectOpfsDatabase,sqliteWebOpener) are inpackage:cloud_firestore_dart_sqlite/web.dart.