backOff<T> function
TopLevel lambda to apply BackOff to functions.
Implementation
Future<T> backOff<T>(
FutureOr<T> Function() func, {
Duration delayFactor = const Duration(milliseconds: 200),
double randomizationFactor = 0.25,
Duration maxDelay = const Duration(seconds: 30),
int maxAttempts = 8,
FutureOr<bool> Function(Object error, int attempt)? retryIf,
}) =>
BackOff(
func,
delayFactor: delayFactor,
randomizationFactor: randomizationFactor,
maxDelay: maxDelay,
maxAttempts: maxAttempts,
retryIf: retryIf,
).call();