RetryPolicy class sealed
Base class for retry policies. Defines when and how to retry a failed task.
- Annotations
Constructors
- RetryPolicy.custom({required int maxAttempts, required Duration delayForAttempt(int attempt)})
-
Creates a custom backoff policy.
The
delayForAttemptfunction is called with the attempt number (1-based) and should return the delay before that attempt.constfactory - RetryPolicy.exponential({required int maxAttempts, required Duration initialDelay, Duration? maxDelay, double? multiplier, double? jitter})
-
Creates an exponential backoff policy.
Delay doubles (or multiplies) each attempt with optional jitter.
Default: maxDelay = 5 hours, multiplier = 2.0, jitter = 0.15 (±15%)
constfactory
- RetryPolicy.linear({required int maxAttempts, required Duration delay})
-
Creates a linear backoff policy.
Retries with the same
delaybetween attempts.constfactory - RetryPolicy.none()
-
Creates a no-retry policy.
constfactory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- maxAttempts → int
-
Maximum number of attempts (including the initial one).
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toMap(
) → Map< String, dynamic> - Serializes to a map for passing to the platform.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited