TimeoutException class

Exception thrown when a task exceeds its timeout duration

This exception is thrown when a task configured with timeout or TaskTimeouts doesn't complete within the specified duration.

Example:

final limit = fLimit(2);

final handle = limit(
  () async {
    await Future.delayed(Duration(seconds: 10));
    return 'result';
  },
  timeout: Duration(seconds: 1),
);

try {
  await handle;
} on TimeoutException catch (e) {
  print('Task timed out after ${e.duration}');
}
Implemented types

Constructors

TimeoutException(Duration duration, {TimeoutStage stage = TimeoutStage.run, String message = 'Task timed out'})
Creates a timeout exception with the given duration and optional message

Properties

duration → Duration
The timeout duration that was exceeded
final
hashCode → int
The hash code for this object.
no setterinherited
message → String
The timeout message
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stage → TimeoutStage
The lifecycle phase where the timeout happened.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override

Operators

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