create static method

Future<SembastCacheManager> create({
  1. String? databasePath,
  2. String databaseName = "sembast_cache_manager",
})

Creates a new SembastCacheManager instance.

Platform-specific behavior:

  • Web platform: databasePath is ignored. The database is stored in IndexedDB using databaseName as the database name.
  • Native platforms (Android, iOS, macOS, Linux, Windows): databasePath is required. The database file is created at {databasePath}/{databaseName}.db.

Parameters:

  • databasePath: Required on native platforms, ignored on web.
  • databaseName: Name of the database. Defaults to "sembast_cache_manager".

Throws ArgumentError on native platforms if databasePath is null or empty.

Implementation

static Future<SembastCacheManager> create({
  String? databasePath,
  String databaseName = "sembast_cache_manager",
}) async {
  final database = await openDatabase(
    databasePath: databasePath,
    databaseName: databaseName,
  );

  return SembastCacheManager(database);
}