onCancel method
Called when the attached token is cancelled.
It's not necessary to detach from the token in this method, as cancellation tokens detach from all cancellables when cancelled.
Implementation
@override
void onCancel(Exception cancelException, [StackTrace? stackTrace]) {
_internalCompleter.completeError(
cancelException,
stackTrace ?? StackTrace.current,
);
_onCancelCallback?.call();
}