EventPlugin class abstract
Base class for implementing event handling in Vyuh applications.
The event plugin provides a pub/sub system for decoupled communication between different parts of the application. It supports:
- Event subscription with on and once
- Event emission with emit
- Automatic cleanup of event subscriptions
Example:
// Subscribe to events
final dispose = vyuh.event.on<UserLoggedInEvent>((event) {
print('User ${event.data.userId} logged in');
});
// Emit events
vyuh.event.emit(UserLoggedInEvent(
data: UserData(userId: '123'),
));
// Clean up subscription
dispose();
- Inheritance
- Mixed-in types
- Implementers
Constructors
- EventPlugin.new({required String name, required String title})
Properties
Methods
-
dispose(
) → Future< void> -
inherited
-
emit<
T extends VyuhEvent> (T event) → void - Emit an event to all subscribers.
-
init(
) → Future< void> -
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
on<
T extends VyuhEvent> (VyuhEventListener< T> listener) → DisposeFunction -
Subscribe to events of type
T
. -
once<
T extends VyuhEvent> (VyuhEventListener< T> listener) → void -
Subscribe to a single occurrence of an event of type
T
. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited