RefreshRetryConfig class

Configuration for retrying a refresh attempt.

Maps directly onto the parameters of resilify's RetryHelper.retry. The default retryIf uses resilify's Failure.isRetryable — true for any 5xx, 408 (timeout), or 429 (rate limit) — so the refresh is retried on transient errors but stops immediately on 401 (auth dead) or other 4xx client errors.

Constructors

RefreshRetryConfig({int maxAttempts = 1, Duration delay = const Duration(milliseconds: 500), Duration? maxDelay, double backoffFactor = 2.0, double jitter = 0.0, Duration? attemptTimeout, Random? random, bool retryIf(Failure failure)?})
Creates a config. With the defaults the refresh is attempted once and no retries are made (matches the spec of token_keeper 1.0.x).
const
RefreshRetryConfig.exponential({int maxAttempts = 3, Duration delay = const Duration(milliseconds: 200), Duration? maxDelay = const Duration(seconds: 5), double backoffFactor = 2.0, double jitter = 0.2, Duration? attemptTimeout})
Convenience: exponential backoff for transient (isRetryable) failures.
factory

Properties

attemptTimeout → Duration?
Bound for each individual attempt; exceeding it yields Failure.timeout(). null = wait indefinitely.
final
backoffFactor → double
Multiplier applied to delay on each successive failure.
final
delay → Duration
Base wait between attempts; doubled on each retry by backoffFactor.
final
hashCode → int
The hash code for this object.
no setterinherited
jitter → double
[0, jitter] randomness multiplier on the back-off; 0.0 disables.
final
maxAttempts → int
Total attempts including the first call. 1 disables retries.
final
maxDelay → Duration?
Caps the wait between attempts after backoff. null = no cap.
final
random → Random?
Optional Random source so jitter is deterministic in tests.
final
retryIf → bool Function(Failure failure)?
Predicate deciding whether to retry given the latest failure. Defaults to failure.isRetryable (true for 5xx, 408, 429).
final
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
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

defaultRetryIf(Failure failure) → bool
The default retry predicate used when retryIf is null.