RetryPolicy class

Retry policy configuration for handling failed requests

Constructors

RetryPolicy({int maxRetries = 3, Duration initialDelay = const Duration(seconds: 1), Duration maxDelay = const Duration(seconds: 30), double backoffMultiplier = 2.0, bool shouldRetry(Exception exception, int retryCount) = _defaultShouldRetry})
Creates a retry policy with specified parameters
const

Properties

backoffMultiplier double
Multiplier for exponential backoff
final
hashCode int
The hash code for this object.
no setterinherited
initialDelay Duration
Initial delay before the first retry
final
maxDelay Duration
Maximum delay between retries
final
maxRetries int
Maximum number of retry attempts
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shouldRetry bool Function(Exception exception, int retryCount)
Function to determine if a request should be retried
final

Methods

copyWith({int? maxRetries, Duration? initialDelay, Duration? maxDelay, double? backoffMultiplier, bool shouldRetry(Exception exception, int retryCount)?}) RetryPolicy
Creates a copy of this retry policy with updated values
getDelayForRetry(int retryAttempt) Duration
Calculates the delay for a specific retry attempt using exponential backoff
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