TimeoutCancellationToken class
A CancellationToken that automatically cancels after a given duration.
See also:
- CancellationToken, which this class is based on.
- Inheritance
-
- Object
- CancellationToken
- TimeoutCancellationToken
Constructors
- TimeoutCancellationToken(Duration duration, {Exception? timeoutException, bool lazyStart = false})
- Creates a TimeoutCancellationToken with the given timeout duration.
Properties
- exception → Exception
-
The exception given when the token was cancelled.
no setterinherited
- hasCancellables → bool
-
Whether or not the token has any attached cancellables.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- isCancelled → bool
-
Whether or not the token has been cancelled.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
attach(
Cancellable cancellable) → void -
Attaches a Cancellable to this token.
override
-
cancel(
[Exception exception = const CancelledException()]) → void -
Cancels all operations with this token.
override
-
detach(
Cancellable cancellable) → void -
Detaches a Cancellable from this token.
inherited
-
merge(
CancellationToken other) → MergedCancellationToken -
Merges this CancellationToken with another to create a single token
that will be cancelled when either token is cancelled.
inherited
-
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