exists method

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

Returns true if the keystore currently contains key, else false. The backend-agnostic existence check — the same call site works against every backend.

Should be O(1) on every backend that ships with this package (Hive uses Box.containsKey; SQL backends use an indexed SELECT 1 ... LIMIT 1).

Implementation

@override
Future<bool> exists(String key) async => _db.raw.select(
    'SELECT 1 FROM notifications WHERE id = ? LIMIT 1;', [key]).isNotEmpty;