NyEventBus class
Constructors
- NyEventBus()
-
factory
Properties
- debugMode ↔ bool
-
Enable debug mode to log event broadcasts
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- onBroadcast ↔ void Function(NyEvent event, int listenerCount)?
-
Optional callback invoked before broadcasting to listeners
getter/setter pair
- onError ↔ void Function(Object error, StackTrace stackTrace)?
-
Optional error handler called when a listener throws an exception
getter/setter pair
-
registeredEventTypes
→ List<
Type> -
Get all registered event types
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
broadcast(
NyEvent event, [Map? data]) → Future< void> -
clear(
) → void - Clear all subscriptions
-
clearType<
T extends NyEvent> () → void - Clear all subscriptions for a specific event type
-
hasListeners<
T extends NyEvent> () → bool - Check if there are any listeners for a specific event type
-
listenerCount<
T extends NyEvent> () → int - Get the number of listeners for a specific event type
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
off<
T extends NyEvent> (NyListener listener) → void -
on<
T extends NyEvent> (NyListener listener) → void -
once<
T extends NyEvent> (NyListener listener) → void - Subscribe a listener that will be automatically removed after first execution
-
removeListener(
NyListener listener) → void - Remove a listener without needing to specify the type
-
stream<
T extends NyEvent> () → Stream< T> - Get a stream of events for a specific type The stream will receive events whenever they are broadcast
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited