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 delayForAttempt function is called with the attempt number (1-based) and should return the delay before that attempt.
const
factory
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%)
const
factory
RetryPolicy.linear({required int maxAttempts, required Duration delay})
Creates a linear backoff policy. Retries with the same delay between attempts.
const
factory
RetryPolicy.none()
Creates a no-retry policy.
const
factory

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