databaseFactoryIo top-level property

DatabaseFactory get databaseFactoryIo

Factory for io databases (flutter, dart vm).

Each database is a file: the path given to DatabaseFactory.openDatabase is a file path, absolute or relative to the current directory. Missing parent folders are created.

var db = await databaseFactoryIo.openDatabase('my_app.db');

In Flutter, use an absolute path in a folder of the app (package:path_provider and package:path):

var dir = await getApplicationSupportDirectory();
var db = await databaseFactoryIo.openDatabase(join(dir.path, 'my_app.db'));

Open each database once and keep the Database for the lifetime of the app. A database file must be used by one process and one isolate only (sembast_sqflite is cross process safe).

Throws an UnimplementedError when used on the web: use databaseFactoryWeb from package:sembast_web there.

Implementation

DatabaseFactory get databaseFactoryIo => database_io.databaseFactoryIo;