addCatalog method

Future<void> addCatalog(
  1. MokuroCatalog catalog
)

Add a selected catalog to the database.

Implementation

Future<void> addCatalog(MokuroCatalog catalog) async {
  await _database.writeTxnSync(() async {
    if (catalog.id != null &&
        _database.mokuroCatalogs.getSync(catalog.id!) != null) {
      _database.mokuroCatalogs.deleteSync(catalog.id!);
    }
    _database.mokuroCatalogs.putSync(catalog);
  });
}