EventBus class Null safety

Dispatches events to listeners using the Dart Stream API. The EventBus enables decoupled applications. It allows objects to interact without requiring to explicitly define listeners and keeping track of them.

Not all events should be broadcasted through the EventBus but only those of general interest.

Events are normal Dart objects. By specifying a class, listeners can filter events.


EventBus({bool sync = false})
Creates an EventBus. [...]
EventBus.customController(StreamController controller)
Instead of using the default StreamController you can use this constructor to pass your own controller. [...]


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
streamController StreamController
Controller for the event bus stream.


destroy() → void
Destroy this EventBus. This is generally only in a testing context.
fire(dynamic event) → void
Fires a new event on the event bus with the specified event.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
on<T>() Stream<T>
Listens for events of Type T and its subtypes. [...]
toString() String
A string representation of this object. [...]


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