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.

Example

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

Implementation

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