RetryHelper class

Retries an async operation with exponential backoff and jitter.

Used for network operations that may fail transiently — server hiccup, temporary connection drop, rate limit. The caller decides via shouldRetry whether a particular error is worth retrying (don't retry auth errors, validation errors, etc.).

Backoff schedule: initialDelay, ×2, ×2, ... up to maxDelay. Jitter (±25%) is added to prevent thundering herd when many clients retry simultaneously after an outage.

Properties

hashCode int
The hash code for this object.
no setterinherited
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

run<T>({required Future<T> operation(), int maxAttempts = 3, Duration initialDelay = const Duration(milliseconds: 500), Duration maxDelay = const Duration(seconds: 8), bool shouldRetry(Object error)?, void onRetry(int attempt, Object error)?}) Future<T>