cancel method
Cancels all operations with this token.
An optional exception
can be provided to give a cancellation reason.
Implementation
void cancel([Exception exception = const CancelledException()]) {
if (_isCancelled) return;
_isCancelled = true;
_exception = exception;
for (Cancellable cancellable in _attachedCancellables) {
cancellable.onCancel(exception);
}
_attachedCancellables.clear();
}