EventEmitter class
Base class for event emitter functionality Provides methods for event subscription, unsubscription, and emission
Constructors
Properties
-
eventNames
→ List<
String> -
Get all registered event names
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
emit(
String eventName, [dynamic args]) → dynamic - Emit an event with optional arguments Returns the result of the last listener execution
-
hasListeners(
String eventName) → bool - Check if there are any listeners for a specific event
-
listenerCount(
String eventName) → int - Get the number of listeners for a specific event
-
listeners(
String eventName) → Set< EventListener> - Get all listeners for a specific event
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
off(
String eventName, [EventListener? listener]) → void - Remove an event listener or all listeners for an event
-
on(
String eventName, EventListener listener) → void - Add an event listener for a specific event
-
once(
String eventName, EventListener listener) → void - Add a one-time event listener that will be removed after first execution
-
removeAllListeners(
[String? eventName]) → void - Remove all event listeners, optionally for a specific event
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited