RateLimit class

Rate limiting configuration.

Throttle background jobs to avoid overwhelming external resources. Excess tasks are queued and drained when the time window resets.

Example:

// Max 10 API calls per minute
const limit = RateLimit(
  maxExecutions: 10,
  window: Duration(minutes: 1),
);

await TaskFlow.enqueue(
  'apiCall',
  rateLimit: limit,
);

Constructors

RateLimit({required int maxExecutions, required Duration window})
const

Properties

hashCode int
The hash code for this object.
no setterinherited
maxExecutions int
Maximum executions allowed per window
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
window Duration
Time window
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toMap() Map<String, dynamic>
Convert to map
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

aggressive → const RateLimit
conservative → const RateLimit
Common presets
hourly → const RateLimit
moderate → const RateLimit