delayForAttempt method
Calculates the delay for a specific attempt using exponential backoff.
Formula: min(initialDelay * 2^attempt, maxDelay)
Implementation
Duration delayForAttempt(int attempt) {
final exponentialDelay = initialDelay * (1 << attempt);
return exponentialDelay > maxDelay ? maxDelay : exponentialDelay;
}