RateLimitAllowedEvent class final

Event published when a request is allowed under the configured rate limit.

Observers can use this event to:

  • Track successful, allowed requests.
  • Update monitoring metrics (e.g., allowed request counters).
  • Trigger auditing or logging of usage patterns.
  • Implement dynamic behavior based on allowed requests (e.g., adaptive throttling).

This event is a subclass of RateLimitEvent and carries:

  • source: The identifier of the entity making the request (e.g., user ID, IP address, API key).
  • limitName: The name of the rate-limited resource or bucket (e.g., "login_attempts").
  • timestamp: Optional time at which the event occurred; defaults to the current time.

Example

// Create an event for an allowed request
final allowedEvent = RateLimitAllowedEvent('user:42', 'login_attempts');

// Publish the event to the application event system
eventPublisher.publish(allowedEvent);

// Observer can handle this event to increment metrics
allowedEventListener.onEvent(allowedEvent);
Inheritance

Constructors

RateLimitAllowedEvent(Object source, String limitName, [DateTime? timestamp])
Creates a new event indicating that a request was allowed by the rate limiter.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
limitName String
The name of the rate-limited resource or bucket.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

equalizedProperties() List<Object?>
Mixin-style contract for value-based equality, hashCode, and toString.
inherited
getPackageName() String
Represents an abstraction for identifying the package that an object, resource, or service belongs to.
inherited
getSource() Object
Returns the source of the event.
inherited
getTimestamp() DateTime
Returns the timestamp of the event.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override
toStringOptions() → ToStringOptions
inherited

Operators

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