exists method

  1. @override
Future<bool> exists(
  1. String path
)
override

Check if a database exists

Implementation

@override
Future<bool> exists(String path) async {
  late idb.Database db;
  try {
    db = await idbFactory.open(path);
    var meta = await db
        .transaction(idbInfoStore, idbModeReadOnly)
        .objectStore(idbInfoStore)
        .getObject(jdb.metaKey);
    if (meta is Map && meta['sembast'] is int) {
      return true;
    }
  } catch (_) {
  } finally {
    try {
      db.close();
    } catch (_) {}
  }
  return false;
}