doOnEach method
Invokes the given callback function when the stream emits data, emits an error, or emits done. The callback receives a StreamNotification object.
The StreamNotification object contains the NotificationKind of event (OnData, onDone, or OnError), and the item or error that was emitted. In the case of onDone, no data is emitted as part of the StreamNotification.
Example
Stream.fromIterable([1])
.doOnEach(print)
.listen(null); // Prints DataNotification{value: 1}, DoneNotification{}
Implementation
Stream<T> doOnEach(
void Function(StreamNotification<T> notification) onEach) =>
DoStreamTransformer<T>(onEach: onEach).bind(this);