ExponentialBackoff class

Exponential back-off: baseDelay * 2^attempt, optionally jittered.

attempt 0 → 1 s
attempt 1 → 2 s
attempt 2 → 4 s
...
Inheritance
Annotations

Constructors

ExponentialBackoff({Duration baseDelay = const Duration(seconds: 1), Duration maxDelay = const Duration(seconds: 30), bool withJitter = true})
const

Properties

baseDelay Duration
The base delay (multiplied by 2^attempt).
final
hashCode int
The hash code for this object.
no setterinherited
maxDelay Duration
Upper bound — the computed delay is capped at this value.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
withJitter bool
When true, a random jitter of ±25 % is applied to reduce thundering herd effects.
final

Methods

delay(int attempt) Duration
Returns the delay before the given attempt (0-indexed).
override
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