CancelToken class

Cooperative cancellation, the Dart counterpart of the web AbortSignal.

Provider adapters and the agent loop take a CancelToken; callers cancel in-flight work via CancelTokenSource.cancel. Cancellation is delivered asynchronously through onCancel so listeners never run reentrantly inside CancelTokenSource.cancel.

Properties

cancelReason → Object?
The reason passed to CancelTokenSource.cancel, if any.
no setter
hashCode → int
The hash code for this object.
no setterinherited
isCancelled → bool
Whether CancelTokenSource.cancel has been called.
no setter
onCancel → Future<void>
A future that completes when the token is cancelled.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
throwIfCancelled() → void
Throws CancelledException if the token is cancelled.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited