RateLimiter class
Bounds how many requests NetGuard has in flight at once, and optionally how fast new ones may start.
Prevents a screen that fires twenty requests on mount from saturating the connection pool and timing each other out.
Constructors
- RateLimiter({int maxConcurrent = 8, Duration minInterval = Duration.zero})
Properties
- activeCount → int
-
Operations currently running.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- maxConcurrent → int
-
Maximum number of simultaneously running operations.
final
- minInterval → Duration
-
Minimum spacing between two operation starts.
Duration.zerodisables pacing and applies only the concurrency bound.final - pendingCount → int
-
Operations waiting for a slot.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
drain(
) → void - Release every waiter, e.g. when the client is closed.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
run<
T> (Future< T> action()) → Future<T> -
Run
actiononce a slot is free, releasing the slot afterwards. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited