createAsync method

Future<void> createAsync()

Create this store asynchronously

Does nothing if the store already exists.

Implementation

Future<void> createAsync() async {
  if (ready) return;

  final db = await Isar.open(
    [DbStoreDescriptorSchema, DbTileSchema, DbMetadataSchema],
    name: _id.toString(),
    directory: _rootDirectory.path,
    maxSizeMiB: FMTC.instance.settings.databaseMaxSize,
    compactOnLaunch: FMTC.instance.settings.databaseCompactCondition,
    inspector: false,
  );
  await db.writeTxn(
    () => db.storeDescriptor.put(DbStoreDescriptor(name: _name)),
  );
  _registry.register(_id, db);
}