on<T extends E> method
Returns a filtered stream of events of specific type T
.
Uses runtime type checking and casting for type safety.
Errors in event handlers are caught and forwarded to the subscriber's error handler (if provided).
Implementation
@override
Stream<T> on<T extends E>() => _controller.stream.where((event) => event is T).cast<T>();