RateLimiter class
Utility limiting Function invokes to requests per the specified per.
Constructors
- RateLimiter({int requests = 5, Duration per = const Duration(seconds: 1)})
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- per → Duration
-
Duration, per which the specified number of requests should be made.
final
-
queue
→ Queue<
Mutex> -
Queue of Mutexes locking the functions invoked.
final
- requests → int
-
Requests allowed to be invoked in per.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clear(
) → void - Clears this RateLimiter.
-
execute<
T> (FutureOr< T> function()) → Future<T> -
Executes the
function
limited to the requests per per. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited