aloisdeniel/dio_retry

can not set retryEvaluator

Closed this issue · 2 comments

I saw the code and followed here: dio_retry
Global retry options

final dio = Dio()
  ..interceptors.add(RetryInterceptor(
    options: const RetryOptions(
      retries: 3, // Number of retries before a failure
      retryInterval: const Duration(seconds: 1), // Interval between each retry
      retryEvaluator: (error) => error.type != DioErrorType.CANCEL && error.type != DioErrorType.RESPONSE, // Evaluating if a retry is necessary regarding the error. It is a good candidate for updating authentication token in case of a unauthorized error (be careful with concurrency though)
    )
  )
);

but failed when setting up retryEvaluator

I tried to configure like example, but still got the same error.
It's a mistake or I haven't done it correctly, can anyone help me?

image

@hungbu @aloisdeniel
The sample code is slightly incorrect. You should remove the const from before RetryOptions. I don't have enough knowledge in dart/flutter to explain why this needs to be done. But this gets rid of the error.

Hope this helps!

it works

thanks @manumohn