doOnCancel method

Observable<T> doOnCancel (
  1. void onCancel(
      )
    )
    inherited

    Invokes the given callback function when the stream subscription is cancelled. Often called doOnUnsubscribe or doOnDispose in other implementations.

    Example

    final subscription = new Observable.timer(1, new Duration(minutes: 1))
      .doOnCancel(() => print("hi"));
      .listen(null);
    
    subscription.cancel(); // prints "hi"
    

    Implementation

    Observable<T> doOnCancel(void onCancel()) =>
        transform(DoStreamTransformer<T>(onCancel: onCancel));