TimeoutSupport mixin
Mixin that adds timeout capabilities to CancellableEvent.
Automatically cancels the event after the specified timeout duration. Also provides timing information and timeout state.
Example:
class ProcessOrderEvent extends CancellableEvent with TimeoutSupport {
ProcessOrderEvent({Duration? timeout}) {
this.timeout = timeout;
}
}
- Superclass constraints
Properties
- elapsedTime → Duration
-
The elapsed time since the event was created
no setter
-
groupsToRebuild
↔ Set<
String> ? -
The set of widget rebuild groups this event should trigger.
getter/setter pairinherited
- hashCode → int
-
The hash code for this object.
no setteroverride
- isCancelled → bool
-
Whether this event has been cancelled
no setterinherited
- isTimedOut → bool
-
Whether this event was cancelled due to timeout
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- timeout ↔ Duration?
-
Gets the current timeout duration, if any
getter/setter pair
- timeRemaining → Duration?
-
The time remaining before timeout, or null if no timeout set
no setter
-
whenCancelled
→ Future<
void> -
Future that completes when the event is cancelled
no setterinherited
Methods
-
cancel(
) → void -
Cleanup timer when cancelled
override
-
close(
) → Future< void> -
Called when the event is disposed.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reset(
) → void -
Reset timeout state for testing
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override