doOnEach method

Observable<T> doOnEach (void onEach(Notification<T> notification))

Invokes the given callback function when the stream emits data, emits an error, or emits done. The callback receives a Notification object.

The Notification object contains the Kind 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 Notification.


new Observable.just(1)
  .listen(null); // prints Notification{kind: OnData, value: 1, errorAndStackTrace: null}, Notification{kind: OnDone, value: null, errorAndStackTrace: null}


Observable<T> doOnEach(void onEach(Notification<T> notification)) =>
    transform(DoStreamTransformer<T>(onEach: onEach));