EventBus class

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.

Constructors

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. [...]

Properties

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.
read-only

Methods

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. [...]
inherited
on<T>() Stream<T>
Listens for events of Type T and its subtypes. [...]
toString() String
Returns a string representation of this object.
inherited

Operators

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