RetryPolicy class

Defines a policy for retrying failed operations.

Constructors

RetryPolicy({int maxRetries = 3, RetryStrategy strategy = RetryStrategy.fixed, Duration baseDelay = const Duration(seconds: 1), Duration? maxDelay, bool retryIf(Object error)?, void onRetry(Object error, int attempt, Duration delay)?})
const

Properties

baseDelay Duration
The base delay used as a starting point for calculations.
final
hashCode int
The hash code for this object.
no setterinherited
maxDelay Duration?
Optional maximum delay allowed between retries.
final
maxRetries int
Number of times to retry before giving up.
final
onRetry → void Function(Object error, int attempt, Duration delay)?
Optional callback triggered on each retry attempt.
final
retryIf bool Function(Object error)?
Optional filter to determine if an error should trigger a retry.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
strategy RetryStrategy
The strategy used to calculate the delay between retries.
final

Methods

execute<T>(Future<T> action()) Future<T>
Executes the action within the retry logic.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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