CancellationController class final
The writable side of a cancellation.
A caller creates a controller, passes its token into an operation (e.g.
ai.generate(..., cancel: controller.token)), and later calls cancel to
request that the operation stop.
This is the Dart analog of the Web AbortController.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isCancelled → bool
-
Whether cancel has already been called.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- token → CancellationToken
-
The read-only token to hand to the operation being controlled.
final
Methods
-
cancel(
[Object? reason]) → void -
Requests cancellation (idempotent). An optional
reasonis surfaced on CancellationToken.reason and the thrownCancelledException. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited