TimeoutCancellationToken class

A CancellationToken that automatically cancels after a given duration.

See also:

Inheritance

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

attachCancellable(Cancellable cancellable) → void
Attaches a Cancellable to this token.
override
cancel([Exception? exception]) → void
Cancels all operations with this token.
override
cancelWithReason(String? cancellationReason) → void
A convenience method for cancelling the token with a CancelledException that includes the reason for cancellation.
inherited
detachCancellable(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
throwIfCancelled() → void
Throws the cancellation exception if the token has already been cancelled.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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