EventBus class abstract

An bus which receives every event from an scope, dispatches them to the correct handler and keeps the last of each cacheable event saved.

Constructors

EventBus()
Create the implementation of an EventBus
factory

Properties

allEvents Stream
An Stream of every event added to this bus.
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
unhandledEvents Stream
An Stream of the events which were not handled by any client of the bus.
no setter

Methods

add<T>(T event) → void
Add an event to the bus. The type argument is needed for caching.
addError<E, Event extends IMayThrowAn<E>>(E error) → void
Add an error to the bus That will be sent to the listeners of Event.
close() Future<void>
Close this bus.
events<T extends IAmRetrievable>({Duration retrieveTimeout = const Duration(milliseconds: 10), Object? argument}) Stream<T>
The Stream for the next events of type T + the last cached one or an Retrieved one.
eventsOrErrors<E, Event extends IAmRetrievableAndMayThrowAn<E>>({Duration retrieveTimeout = const Duration(milliseconds: 10), Object? argument}) Stream<Either<E, Event>>
The Stream for the next events of type Event + the last cached one or an Retrieved one or the errors emitted by this Event type. Prefer this over events for events which IMayThrowAn.
nextEvents<T>() Stream<T>
An Stream containing only the next events of type T.
nextEventsOrErrors<E, Event extends IMayThrowAn<E>>() Stream<Either<E, Event>>
An Stream containing only the next events of type Event or the errors emitted by this Event type. Prefer this over nextEvents for events which IMayThrowAn.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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