shouldRetry method

bool shouldRetry(
  1. RetryPolicy policy,
  2. int attempt
)

Returns true if the step should be retried given the current attempt.

attempt is 1-based (the first execution is attempt 1).

Implementation

bool shouldRetry(RetryPolicy policy, int attempt) {
  return switch (policy) {
    RetryPolicyNone() => false,
    RetryPolicyFixed(maxAttempts: final max) => attempt < max,
    RetryPolicyExponential(maxAttempts: final max) => attempt < max,
  };
}