watch method

  1. @override
Stream<WatchEvent> watch(
  1. String table, {
  2. String? key,
})

Returns a stream of changes. Use the optional key parameter to filter events or leave it empty to get all changes.

Implementation

@override
Stream<WatchEvent> watch(String table, {String? key}) {
  if (!tables.contains(table)) throw 'Unknown table: $table';
  return _boxes[table]!.watch(key: key).map((event) => (
        key: event.key,
        value: event.value!.value,
        isDeleted: (event.value as Record).isDeleted,
      ));
}