ExponentialBackoffRetryPolicy class
Exponential backoff retry policy — the OpenTelemetry standard convention.
Each retry waits progressively longer, with the delay multiplied by multiplier after each attempt. The delay is capped at maxInterval and retries stop after maxRetries attempts or maxElapsed time.
Default values follow the OTel OTLP exporter specification:
- multiplier: 1.5
- maxInterval: 30 seconds
- maxRetries: 5
- maxElapsed: 5 minutes (300 seconds)
Example
final policy = ExponentialBackoffRetryPolicy(
multiplier: 2.0,
maxInterval: const Duration(seconds: 60),
maxRetries: 10,
);
- Inheritance
-
- Object
- ReportRetryPolicy
- ExponentialBackoffRetryPolicy
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- initialDelay → Duration
-
Initial delay for the first retry.
final
- maxElapsed → Duration
-
Maximum total elapsed time for all retries.
final
- maxInterval → Duration
-
Maximum delay between retries.
final
- maxRetries → int
-
Maximum number of retry attempts.
final
- multiplier → double
-
Multiplier applied to the delay after each retry.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
nextDelay(
int attemptNumber, Duration lastDelay) → Duration? -
Calculate the delay before the next retry attempt.
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