RateLimiter class

A simple in-memory rate limiter middleware.

Constructors

RateLimiter({int maxRequests = 100, Duration window = const Duration(minutes: 1)})
Creates a new RateLimiter instance.

Properties

hashCode → int
The hash code for this object.
no setterinherited
maxRequests → int
The maximum number of requests allowed within the window.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
window → Duration
The duration window for the rate limit.
final

Methods

handle() → Middleware
Returns a Middleware that enforces the rate limit.
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