RetryStrategy class
Exponential backoff retry strategy for ad loading.
Calculates delays as baseDelayMs * 2^attempt:
- Attempt 0: baseDelayMs (e.g. 1000ms)
- Attempt 1: baseDelayMs * 2 (e.g. 2000ms)
- Attempt 2: baseDelayMs * 4 (e.g. 4000ms)
Constructors
- RetryStrategy({int maxRetries = 3, int baseDelayMs = 1000})
-
Creates a retry strategy.
const
Properties
- baseDelayMs → int
-
Base delay in milliseconds for exponential backoff.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- maxRetries → int
-
Maximum number of retry attempts.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
delayForAttempt(
int attempt) → int -
Returns the delay in milliseconds for the given
attempt(0-indexed). -
execute<
T> ({required Future< T> action(), void onRetry(int attempt, Object error)?, Duration delayOverride(int attempt)?}) → Future<T?> -
Executes
actionwith retry and exponential backoff. -
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