copyWith method
RetryConfig
copyWith({
- int? maxAttempts,
- Duration? initial,
- Duration? max,
- Duration? minDelay,
- double? multiplier,
- double? decorrelationFactor,
- RetryStrategy? strategy,
- bool? honorRetryAfter,
- bool? allowNonIdempotent,
- Set<
Code> ? retryableCodes, - bool isRetryable(
- ConnectException error
- double jitterSource()?,
- Future<
void> sleep(- Duration delay
Returns a copy with the given fields overridden. Mirrors the Go implementation's pattern of starting from defaults and tweaking.
Implementation
RetryConfig copyWith({
int? maxAttempts,
Duration? initial,
Duration? max,
Duration? minDelay,
double? multiplier,
double? decorrelationFactor,
RetryStrategy? strategy,
bool? honorRetryAfter,
bool? allowNonIdempotent,
Set<Code>? retryableCodes,
bool Function(ConnectException error)? isRetryable,
double Function()? jitterSource,
Future<void> Function(Duration delay)? sleep,
}) {
return RetryConfig(
maxAttempts: maxAttempts ?? this.maxAttempts,
initial: initial ?? this.initial,
max: max ?? this.max,
minDelay: minDelay ?? this.minDelay,
multiplier: multiplier ?? this.multiplier,
decorrelationFactor: decorrelationFactor ?? this.decorrelationFactor,
strategy: strategy ?? this.strategy,
honorRetryAfter: honorRetryAfter ?? this.honorRetryAfter,
allowNonIdempotent: allowNonIdempotent ?? this.allowNonIdempotent,
retryableCodes: retryableCodes ?? this.retryableCodes,
isRetryable: isRetryable ?? this.isRetryable,
jitterSource: jitterSource ?? this.jitterSource,
sleep: sleep ?? this.sleep,
);
}