getKeys method

  1. @override
Future<Stream<String>> getKeys({
  1. String? regex,
})
override

Streams the keys, optionally filtered by regex. The returned Future completes once the backend has accepted the request — setup failures (store not open, invalid regex) reject the Future eagerly rather than surfacing mid-stream; the Stream then yields the matching keys.

Implementation

@override
Future<Stream<String>> getKeys({String? regex}) async {
  final re = RegExp(regex ?? '.*');
  final rows = _db.raw.select('SELECT id FROM notifications;');
  return Stream.fromIterable(
      rows.map((r) => r['id'] as String).where(re.hasMatch));
}