http_extensions_retry 0.1.2

Dart native js
Flutter Android iOS web

An http extension that retries failed requests.

http_extensions : retry #

An [http extension] that retries failed requests.

Usage #

final client = ExtendedClient(
  inner: Client(),
  extensions: [
    RetryExtension(
        logger: Logger("Retry"),
        defaultOptions: RetryOptions(
          const RetryOptions(
      retries: 3, // Number of retries before a failure
      retryInterval: const Duration(seconds: 5), // Interval between each retry
      retryEvaluator: (error, response) => error != null, // Evaluating if a retry is necessary regarding the error or the response. It is a good candidate for updating authentication token in case of a unauthorized error (be careful with concurrency though). error or response are at least null
        )),
  ],
);