RetryConfig class

Configuration for retry behavior.

Defines how pagination should retry failed requests with exponential backoff.

Example:

final retryConfig = RetryConfig(
  maxAttempts: 3,
  initialDelay: Duration(seconds: 1),
  maxDelay: Duration(seconds: 10),
  timeoutDuration: Duration(seconds: 30),
);

Constructors

RetryConfig({int maxAttempts = 3, Duration initialDelay = const Duration(seconds: 1), Duration maxDelay = const Duration(seconds: 10), Duration timeoutDuration = const Duration(seconds: 30), bool shouldRetry(Exception error)?})
const

Properties

hashCode int
The hash code for this object.
no setterinherited
initialDelay Duration
Initial delay before the first retry.
final
maxAttempts int
Maximum number of retry attempts before giving up.
final
maxDelay Duration
Maximum delay between retries (for exponential backoff).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shouldRetry bool Function(Exception error)?
Optional callback to determine if a specific error should trigger a retry.
final
timeoutDuration Duration
Timeout duration for each request attempt.
final

Methods

copyWith({int? maxAttempts, Duration? initialDelay, Duration? maxDelay, Duration? timeoutDuration, bool shouldRetry(Exception error)?}) RetryConfig
Creates a copy with updated values.
delayForAttempt(int attempt) Duration
Calculates the delay for a specific 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