cancellation_zone library Null safety

Classes

CancellationToken<T>
A token that can be used to cancel an asynchronous operation running in a child zone.

Extensions

NonNullableCancellationExtension
Extensions that can be used on cancellable operations if they return a non- nullable value.

Functions

checkIfCancelled() → void
Checks whether the active zone is a cancellation zone that has been cancelled. If it is, a CancellationException will be thrown.
doOnCancellation(void callback()) → void
Requests the callback to be invoked when the enclosing asynchronous operation is cancelled.
runCancellable<T>(Future<T> operation()) CancellationToken<T>
Runs an asynchronous operation with support for cancellations.

Exceptions / Errors

CancellationException
Thrown inside a cancellation zone when it has been cancelled.