build static method

Future<SembastAdapter> build(
  1. String path, {
  2. int? version,
  3. OnVersionChangedFunction? onVersionChanged,
  4. DatabaseMode? mode,
  5. SembastCodec? sembastCodec,
})

Builds SembastLocalAdapter.

  • path: The location of the database file
  • version: The expected version
  • onVersionChanged: If version not null and if the existing version is different, onVersionChanged is called
  • mode: The database mode
  • sembastCodec: The codec which can be used to load/save a record, allowing for user encryption

Implementation

static Future<SembastAdapter> build(String path,
    {int? version,
    OnVersionChangedFunction? onVersionChanged,
    DatabaseMode? mode,
    SembastCodec? sembastCodec}) {
  return databaseFactoryIo
      .openDatabase(path,
          version: version,
          onVersionChanged: onVersionChanged,
          mode: mode,
          codec: sembastCodec)
      .then((db) => SembastLocalAdapter._(db, path));
}