whereType<S> method
Discards events from this stream that are not of type S
.
If the source stream is a broadcast stream the result will be as well.
Errors from the source stream are forwarded directly to the result stream.
S
should be a subtype of the stream's generic type, otherwise nothing of
type S
could possibly be emitted, however there is no static or runtime
checking that this is the case.
Implementation
Stream<S> whereType<S>() => transformByHandlers(onData: (event, sink) {
if (event is S) sink.add(event);
});