RetryPolicy class

Immutable exponential-backoff-with-jitter configuration — no timers, no randomness of its own, just the math. RetryExecutor is what actually runs a retry loop against it.

Constructors

RetryPolicy({int maxAttempts = 3, Duration baseDelay = const Duration(milliseconds: 200), Duration maxDelay = const Duration(seconds: 10), Duration? timeout, double jitterFraction = 0.2})
const

Properties

baseDelay → Duration
final
hashCode → int
The hash code for this object.
no setterinherited
jitterFraction → double
Fraction of the (pre-jitter) delay randomized in either direction — 0.2 means the actual delay lands within ±20% of the exponential value, capped to maxDelay either way.
final
maxAttempts → int
final
maxDelay → Duration
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
timeout → Duration?
Per-attempt timeout — null means an attempt can run indefinitely.
final

Methods

delayBeforeAttempt(int attemptNumber, double randomValue) → Duration
Delay before attempt attemptNumber (1-indexed — attempt 1 is the first try, so it's always Duration.zero). randomValue must be in [0, 1]; callers needing determinism (tests, or RetryExecutor's own injected randomFn) supply it directly instead of this class reaching for dart:math's Random itself.
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