cancel method

void cancel([
  1. bool throwOnFirstException = false
])

Communicates a request for cancellation.

The associated CancellationToken will be notified of the cancellation and will transition to state where isCancellationRequested returns true. Any callbacks of cancelable operations registered with the CancellationToken will be executed.

Implementation

void cancel([bool throwOnFirstException = false]) {
  _throwIfDisposed();
  _notifyCancellation(throwOnFirstException);
}