onCancel method
Handles the cancellation of a merged token that this token is currently attached to.
Notifies all attached cancellables of the cancellation and detaches from the merged tokens.
Implementation
@override
void onCancel(Exception cancelException, [StackTrace? stackTrace]) {
_isCancelled = true;
_exception = cancelException;
for (Cancellable cancellable in _attachedCancellables) {
cancellable.onCancel(exception);
}
_attachedCancellables.clear();
for (final CancellationToken token in _tokens) {
token.detach(this);
}
}