exists method

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

Implementation

@override
Future<bool> exists(String key) async {
  final database = await _database;
  final transaction = database.transaction(_recordStore, idbModeReadOnly);
  final value = await transaction
      .objectStore(_recordStore)
      .getObject(_recordId(key));
  await transaction.completed;
  if (value != null) return true;
  if (namespace != 'default' || !_hasLegacyStore) return false;
  final legacy = database.transaction(_legacyStore, idbModeReadOnly);
  final legacyValue = await legacy.objectStore(_legacyStore).getObject(key);
  await legacy.completed;
  return legacyValue != null;
}