on<E extends CacheEvent<T> > method
Listens for events of Type T
and its subtypes.
The method is called like this: myCache.on
If the method is called without a type parameter, the Stream contains every event of this Cache.
The returned Stream is a broadcast stream so multiple subscriptions are allowed.
Implementation
@override
Stream<E> on<E extends CacheEvent<T>>() {
if (E == dynamic) {
return streamController.stream as Stream<E>;
} else {
return streamController.stream.where((event) => event is E).cast<E>();
}
}