retryPolicy method

RetryPolicy retryPolicy({
  1. RetryPolicy? wrapping,
})

Builds a RetryPolicy that records exchanges whose underlying Client.send threw (DNS failure, timeout, connection refused) into the timeline — the failures the interceptor's interceptResponse can't see. Pass it as the InterceptedClient / InterceptedHttp retryPolicy.

On its own it adds no retries: it reports one allowable attempt (enough for http_interceptor to invoke the exception hook) and then declines to retry, so the original exception still propagates after a single send. Pass wrapping to delegate the actual retry decision to your own policy while still logging failures; its retry behavior is preserved. Note that when a wrapped policy exhausts its retries, the final failed attempt is rethrown by http_interceptor without consulting the policy, so that last attempt is not recorded.

Implementation

RetryPolicy retryPolicy({RetryPolicy? wrapping}) =>
    _FailureLoggingRetryPolicy(_inFlight, wrapping);