EventDispatcher class
The default event dispatcher implementation.
This class manages the registration of event listeners and subscribers, and handles the dispatching of events to those listeners. It supports:
- Synchronous listeners
- Asynchronous listeners (Future)
- Queued listeners (ShouldQueue)
- Broadcast events (ShouldBroadcast)
- Event propagation stopping (StoppableEvent)
- Implemented types
Constructors
- EventDispatcher(ContainerInterface container)
- Create a new event dispatcher instance.
Properties
- container → ContainerInterface
-
The service container instance.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
dispatch(
Event event) → Future< void> -
Dispatch an event and call the listeners.
override
-
forget(
Type eventType) → void -
Remove a set of listeners from the dispatcher.
override
-
listen<
T extends Event> (dynamic listener) → void -
Register an event listener with the dispatcher.
override
-
listenType(
Type eventType, dynamic listener) → void -
Register an event listener with the dispatcher by type.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
subscribe(
dynamic subscriber) → void -
Register an event subscriber with the dispatcher.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited