retry library

Retry asynchronous functions with exponential backoff.

For a simple solution see retry, to modify and persist retry options see RetryOptions. Note, in many cases the added configurability is unnecessary and using retry is perfectly fine.


Object holding options for retrying a function.


retry<T>(FutureOr<T> fn(), {Duration delayFactor = const Duration(milliseconds: 200), double randomizationFactor = 0.25, Duration maxDelay = const Duration(seconds: 30), int maxAttempts = 8, FutureOr<bool> retryIf(Exception), FutureOr<void> onRetry(Exception)}) Future<T>
Call fn retrying so long as retryIf return true for the exception thrown, up-to maxAttempts times.