watch<T> method
Emits the value under key in collection now, and again whenever it
changes. Emits null while there is no value.
Implementation
@override
Stream<T?> watch<T>(String collection, String key) {
return guardStream('Failed to watch key "$key" in "$collection"',
() async* {
_ensureInitialized();
final box = await _openBox(collection);
yield box.get(key) as T?;
yield* box.watch(key: key).map((event) => event.value as T?);
});
}