EventBus class

The event bus implementation

Implemented types

Constructors

EventBus({int maxHistoryLength = 100, Map<Type, List<AppEvent Function(AppEvent event)>> map = const {}, bool allowLogging = false})
Create the event bus

Properties

allowLogging bool
allow to log all events this when you call fire the event will be in console log
final
hashCode int
The hash code for this object.
no setterinherited
history List<EventBusHistoryEntry>
The history of events
no setteroverride
inProgress$ Stream<List<AppEvent>>
The list of events that are in progress
no setteroverride
isBusy bool
Whether the event bus is busy
no setteroverride
isBusy$ Stream<bool>
Whether the event bus is busy
no setteroverride
last AppEvent?
The last event
no setteroverride
last$ Stream<AppEvent?>
The last event
no setteroverride
map Map<Type, List<AppEvent Function(AppEvent event)>>
The map of events
final
maxHistoryLength int
The maximum length of history
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clearHistory() → void
Clear the history
override
complete(AppEvent event, {AppEvent? nextEvent}) → void
Complete a event
override
dispose() → void
Dispose the event bus
override
fire(AppEvent event) → void
Fire a event
override
isInProgress<T>() bool
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
on<T extends AppEvent>() Stream<T>
Subscribe EventBus on a specific type of event, and register responder to it.
override
reset() → void
Reset the event bus
override
respond<T>(Responder<T> responder) Subscription
Subscribe EventBus on a specific type of event, and register responder to it.
override
toString() String
A string representation of this object.
inherited
watch(AppEvent event) → void
Fire a event and wait for it to be completed
override
whileInProgress<T extends AppEvent>() Stream<bool>
Subscribe EventBus on a specific type of event, and register responder to it.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited