EventSystem class
A concrete implementation of EventSystemInterface.
This event system supports:
- Priority-based event listeners.
- One-time listeners.
- Grouped events.
- Subscriber-aware management.
- Optional queued execution.
- Future support for broadcasting events.
- Implemented types
- Annotations
-
- @Deprecated('Use EventDispatcher instead')
Constructors
- EventSystem()
- Creates a new EventSystem instance.
Properties
-
eventGroups
→ Map<
String, Set< String> > -
Returns all registered event groups.
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
-
listeners
→ Map<
String, List< EventRegistration> > -
Returns all event listeners.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
subscriberEvents
→ Map<
Object, Set< String> > -
Returns all subscriber-specific event mappings.
no setteroverride
Methods
-
addToGroup(
String groupName, String event) → void -
Adds an
eventto a named groupgroupName.override -
clear(
) → void -
Clears all event listeners, groups, and subscribers.
override
-
emit(
String event, [dynamic payload, bool queue = false]) → Future< void> -
Emits a single
eventwith optionalpayload.override -
emitGroup(
String groupName, [dynamic payload, bool queue = false]) → Future< void> -
Emits all events inside a
groupNamewith optionalpayload.override -
hasListeners(
String event) → bool -
Checks if an
eventhas active listeners.override -
listenerCount(
String event) → int -
Returns the number of listeners attached to
event.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
off(
String event, EventListener listener) → void -
Removes a specific
listenerfrom anevent.override -
offEvent(
String event) → void -
Removes all listeners registered for a specific
event.override -
offSubscriber(
Object subscriber) → void -
Removes all events registered by a specific
subscriber.override -
on(
String event, EventListener listener, {EventPriority priority = EventPriority.normal, bool once = false, Object? subscriber}) → void -
Registers a listener for an
event.override -
once(
String event, EventListener listener, {EventPriority priority = EventPriority.normal, Object? subscriber}) → void -
Registers a one-time listener for
event.override -
removeFromGroup(
String groupName, String event) → void -
Removes an
eventfrom groupgroupName.override -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited