jaguar_throttle 1.3.1

  • Example
  • Installing
  • Versions
  • 49


Rate limiter for Jaguar


class ExampleApi {
  Throttler throttle(_) =>
      new Throttler(new Rate(new Duration(seconds: 10), 100));

  @Get(path: '/hello')
  String sayHello(Context ctx) => 'hello';



Rate class provides an easy to define count per time interval. It is used to specify throttling quote of the Throttler

The constructor of Rate takes interval in Duration and count.

Rate(Duration interval, int count);

To create a rate of 100 requests per 10 seconds:

new Rate(new Duration(seconds: 10), 100);

Id maker

ThrottleIdMaker creates the criteria by which requests are throttled. ThrottleIdMaker is a function that takes Context object and returns a String identifying the request.

typedef FutureOr<String> ThrottleIdMaker(Context ctx);

By default, Throttler uses throttleIdByIp as ThrottleIdMaker. throttleIdByIp throttles requests by remote IP address.


Throttler uses Cache to store request count stats. By default, defaultThrottleCache, which is an InMemoryCache, is used as store.


Throttler sets X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset rate-limit headers with quota, quota remaining and duration in seconds after which quota resets respectively. In case, the quota for the current interval is completely used, Throttler also sets the header Retry-After with duration in seconds after which the client can retry.



  • throttle function based throttler


  • Renamed Throttle to Throttler
  • Introduced Rate structure to hold quota


  • Expose ThrottleState through Interceptor output
  • Use Cache instead of ThrottleStore


  • Initial version, created by Stagehand


// Copyright (c) 2017, Ravi Teja Gudapati. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.

import 'package:jaguar_throttle/jaguar_throttle.dart';

main() {}

1. Depend on it

Add this to your package's pubspec.yaml file:

  jaguar_throttle: "^1.3.1"

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

Alternatively, your editor might support pub get or packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:jaguar_throttle/jaguar_throttle.dart';
Version Uploaded Documentation Archive
1.3.1 Feb 2, 2018 Go to the documentation of jaguar_throttle 1.3.1 Download jaguar_throttle 1.3.1 archive
1.2.6 Jan 13, 2018 Go to the documentation of jaguar_throttle 1.2.6 Download jaguar_throttle 1.2.6 archive
0.2.2 Jul 23, 2017 Go to the documentation of jaguar_throttle 0.2.2 Download jaguar_throttle 0.2.2 archive
0.2.1 Jul 23, 2017 Go to the documentation of jaguar_throttle 0.2.1 Download jaguar_throttle 0.2.1 archive
0.2.0 Jul 23, 2017 Go to the documentation of jaguar_throttle 0.2.0 Download jaguar_throttle 0.2.0 archive
0.1.0 Jul 23, 2017 Go to the documentation of jaguar_throttle 0.1.0 Download jaguar_throttle 0.1.0 archive
0.0.1 Jul 22, 2017 Go to the documentation of jaguar_throttle 0.0.1 Download jaguar_throttle 0.0.1 archive


This feature is new.
We welcome feedback.
More details: scoring.

We analyzed this package, and provided a score, details, and suggestions below.

  • completed on Feb 3, 2018
  • Dart: 2.0.0-dev.20.0
  • pana: 0.10.1


Describes how popular the package is relative to other packages. [more]
0 / 100
Code health derived from static analysis. [more]
98 / 100
Reflects how tidy and up-to-date the package is. [more]
100 / 100
Overall score:
Weighted score of the above. [more]


Detected platforms: Flutter, other

Primary library: package:jaguar_throttle/jaguar_throttle.dart with components: io.


  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.20.1 <2.0.0
jaguar ^1.3.4 1.3.4
jaguar_cache ^0.2.1 0.2.1
Transitive dependencies
args 1.2.0 1.3.0
charcode 1.1.1
collection 1.14.5
convert 2.0.1
crypto 2.0.2+1
http_server 0.9.7
intl 0.15.2
logging 0.11.3+1
meta 1.1.2
mime 0.9.6
path 1.5.1
quiver_hashcode 1.0.0
source_span 1.4.0
stack_trace 1.9.1
string_scanner 1.0.2
typed_data 1.1.5
yaml 2.1.13
Dev dependencies
test ^0.12.0