doOnCancel method
Invokes the given callback function when the Single subscription is cancelled. Often called doOnUnsubscribe or doOnDispose in other implementations.
Example
final subscription = Single.timer(1, Duration(minutes: 1))
.doOnCancel(() => print('hi'))
.listen(null);
subscription.cancel(); // prints 'hi'
Implementation
Single<T> doOnCancel(FutureOr<void> Function() onCancel) =>
forwardSingleWithSink(
() => _DoStreamSingleSink(onCancelCallback: onCancel), true);