commit | 845771af7bb5ab38ab740ce4a31f3b0c7680302b | [log] [tgz] |
---|---|---|
author | Nate Bosch <nbosch@google.com> | Tue Mar 09 13:13:41 2021 -0800 |
committer | GitHub <noreply@github.com> | Tue Mar 09 13:13:41 2021 -0800 |
tree | 2a5054ba27986caa7302456225a6c80eccb30dbd | |
parent | c140142a34c1a2c748daf66064f9c6b08c0ad831 [diff] |
Migrate to null safety (#17) Named arguments are non-nullable with a default instead of a null default. This means that code which was passing null through instead of omitting the argument will be broken, even in unsound mode. I don't expect any code was doing this, and this API is not one that should need to be wrapped with argument forwarding.
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 { print(await client.read('http://example.org')); } finally { client.close(); } }
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.