tree: 9b07b28774e048a8106e57f72c4a8d5aa763a96f [path history] [tgz]
  1. lib/
  2. test/
  3. LICENSE
  4. pubspec.yaml
  5. README.md
pkg/http_throttle/README.md

http_throttle is middleware for the http package that throttles the number of concurrent requests that an HTTP client can make.

// This client allows 32 concurrent requests.
final client = new ThrottleClient(32);

Future<List<String>> readAllUrls(Iterable<Uri> urls) {
  return Future.wait(urls.map((url) {
    // You can safely call as many client methods as you want concurrently, and
    // ThrottleClient will ensure that only 32 underlying HTTP requests will be
    // open at once.
    return client.read(url);
  }));
}