EventType<T extends ApplicationEvent> class
final
π« Represents a typed application event associated with a specific package.
The EventType class is a simple container that binds an ApplicationEvent instance with the name of the package that produced it. This allows events to be categorized, filtered, or routed based on their originating package.
Type Parameter
Tβ The concrete type of ApplicationEvent this EventType holds.
Example
class UserCreatedEvent extends ApplicationEvent {
final String userId;
const UserCreatedEvent(this.userId);
}
@EventListener(EventType<UserCreatedEvent>('user_package'))
void handleUserCreatedEvent(UserCreatedEvent event) {
print("User created: ${event.userId}");
}
void main() {
final event = UserCreatedEvent('12345');
final eventType = EventType(event, 'user_package');
print('Event: ${eventType.event}, Package: ${eventType.packageName}');
}
Use Cases
- Event-driven application architectures.
- Associating events with their defining package/module.
- Passing typed event metadata through the JetLeaf lifecycle.
See also:
- ApplicationEvent π« the base class for application events.
- Annotations
-
- @Generic(EventType)
Constructors
Properties
- hashCode β int
-
The hash code for this object.
no setterinherited
- runtimeType β Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
getType(
) β Class< T> - Returns the type of ApplicationEvent this EventType holds.
-
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