Clone this repo:
  1. c0a1a44 Merge pull request #23 from dart-lang/devoncarew-patch-1 by Devon Carew · 3 weeks ago master
  2. 5d5df12 rev to a dev version by Devon Carew · 4 weeks ago devoncarew-patch-1
  3. 7d77b3c Update pubspec.yaml by Devon Carew · 4 weeks ago
  4. 544fedd Bump actions/checkout from 2 to 3 (#22) by dependabot[bot] · 3 months ago
  5. 7b505c8 Bump dart-lang/setup-dart from 0.3 to 1 (#20) by dependabot[bot] · 12 months ago

Middleware for the http package that transparently retries failing requests.

To use this, just create an RetryClient that wraps the underlying http.Client:

import 'package:http/http.dart' as http;
import 'package:http_retry/http_retry.dart';

Future<void> main() async {
  final client = RetryClient(http.Client());
  try {
  } finally {

By default, this retries any request whose response has status code 503 Temporary Failure up to three retries. It waits 500ms before the first retry, and increases the delay by 1.5x each time. All of this can be customized using the RetryClient() constructor.