RetryPolicy class

Policy for determining retry delays using exponential backoff.

Prevents infinite retries and sync storms by implementing exponential backoff with a maximum retry cap.

Constructors

RetryPolicy({int maxRetries = 5, Duration baseDelay = const Duration(seconds: 2), Duration maxDelay = const Duration(minutes: 5)})
Creates a RetryPolicy with the given parameters.
const
RetryPolicy.defaults()
Creates a RetryPolicy with default values.
factory

Properties

baseDelay → Duration
Base delay duration for the first retry.
final
hashCode → int
The hash code for this object.
no setterinherited
maxDelay → Duration
Maximum delay duration (caps the exponential growth).
final
maxRetries → int
Maximum number of retry attempts allowed.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

nextDelay(int retryCount) → Duration?
Calculates the delay for the next retry attempt.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
shouldRetry(int retryCount) → bool
Checks if a task with the given retry count should be retried.
toString() → String
A string representation of this object.
inherited

Operators

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