EventBus class Null safety

EventBus is a stream based solution to remove dependencies between elements.


final bus = EventBus([
  EventTransformer(HeightProvidedEvent, (event, eventBus) => BmiCalculatedEvent()),
  EventTransformer(WeightProvidedEvent, (event, eventBus) => BmiCalculatedEvent()),
final outputStream = bus.select<BmiCalculatedEvent>();

You can now listen to the outputStream

TODO: Find a way to check circular transformations and remove them.

Implemented types


EventBus([List<EventTransformer<Object, Object>>? transformers])
EventBus will start listening to events when constructed. [...]
EventBus.from(EventBus other)
Creates a copy from another bus.
EventBus.withLogger([List<EventTransformer<Object, Object>>? transformers])
Creates an EventBus with logging ability.


hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
store Store
Events are stored here.
stream Stream<Object>
The internal stream is exposed for customized listening. [...]
transformers Iterable<EventTransformer<Object, Object>>
A list of transformers extracted from transformerMap.


cancelFromStream(String id) EventBus
dispose() Future<void>
Disposes the SubscriptionManager. Closes the StreamController. Unregisters all the Transformers.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
publish(Object message) EventBus
Publishes a single message.
publishAndSave(Object message) EventBus
Publishes and saves messages to store.
publishAndSaveFromFuture(Future<Object> future) EventBus
Publishes and saves the message after resolving a future.
publishAndSaveFromStream(Stream<Object> stream, String id) EventBus
Publishes and saves messages as the stream emits.
publishAndSaveMany(Iterable<Object> messageList) EventBus
Publishes and saves multiple messages.
publishFromFuture(Future<Object> future) EventBus
Publishes the message after resolving a future.
publishFromStore<T extends Object>() EventBus
Publishes a message from store.
publishFromStream(Stream<Object> stream, String id) EventBus
Publishes messages as the stream emits.
publishMany(Iterable<Object> messageList) EventBus
Publishes multiple messages.
registerTransformers(List<EventTransformer<Object, Object>> transformers) EventBus
Registered transformers will run when a source event is hit.
save(Object message) EventBus
Saves message to store.
select<T extends Object>() Stream<T>
Selects a message of type T.
selectFromStore<T extends Object>() → T
Selects a message of type T from store.
toString() String
A string representation of this object. [...]


operator ==(Object other) bool
The equality operator. [...]