checkIfCancelled function

void checkIfCancelled()

Checks whether the active zone is a cancellation zone that has been cancelled. If it is, a CancellationException will be thrown.

Implementation

void checkIfCancelled() {
  final token = Zone.current[_key];
  if (token is CancellationToken && token._cancellationRequested) {
    throw const CancellationException();
  }
}