shouldRetry method
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,
};
}