doOnCancel method
Invokes the given callback function when the stream subscription is cancelled. Often called doOnUnsubscribe or doOnDispose in other implementations.
Example
final subscription = TimerStream(1, Duration(minutes: 1))
.doOnCancel(() => print('hi'))
.listen(null);
subscription.cancel(); // prints 'hi'
Implementation
Stream<T> doOnCancel(FutureOr<void> Function() onCancel) =>
DoStreamTransformer<T>(onCancel: onCancel).bind(this);