EventBus class abstract

Implementers

Constructors

EventBus({bool isModelBus = false})
Factory constructor for EventBus. Creates an EventBusImpl instance.
factory

Properties

allEventStream → Stream<(EventDTO, bool)>
Stream for all sent events (event DTO, and whether it had a listener or not)
no setter
handlers → EventBusHandlers
Handler management without casting bus as EventBusHandlers.
no setter
hashCode → int
The hash code for this object.
no setterinherited
isDisposed → bool
true once dispose has been called
no setter
isModelBus → bool
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() → Future<void>
Closes the all-events stream and every node of the bus. Safe to call twice. After dispose the bus is unusable: send/listen/subscribe/setHandler throw StateError.
haveHandler<T>({String? path, String? target}) → bool
Returns true if the bus contains a handler for the specified topic
haveListener<T>({String? path, String? target}) → bool
Returns true if the bus contains a listener for the specified topic
lastData<T>({String? path, String? target}) → T?
Gets the last data sent to a specific topic.
listen<T>({String? path, String? target}) → Stream<T>
Listens to events on a specific topic. Returns a Stream of the data type T.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
send<T>(T data, {String? path, String? fragment, String? target, Map<String, String>? arguments}) → Future?
Sends an event to the bus. If a handler exists for the topic, it will be called. Returns a Future that completes with the result if EventDTO.completer was called by the handler.
subscribe<T>({String? path, String? target, void onData(T e)?, Function? onError, void onDone()?, bool? cancelOnError}) → StreamSubscription<T>
Subscribe to events on a specific topic.
toString() → String
A string representation of this object.
inherited

Operators

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