EventBusImpl class
- Mixed-in types
- Implementers
Constructors
- EventBusImpl(bool _isModelBus)
- Creates an EventBusImpl instance. If isModelBus is true, the bus behaves as a model bus.
Properties
-
allEventStream
→ Stream<
(EventDTO, bool)> -
Stream for all sent events (event DTO, and whether it had a listener or not)
no setterinherited
- defaultTopicPathSeparator ↔ String
-
getter/setter pairinherited
- handlers → EventBusHandlers
-
Handler management without casting
bus as EventBusHandlers.no setterinherited - hashCode → int
-
The hash code for this object.
no setterinherited
- isDisposed → bool
-
true once dispose has been called
no setterinherited
- isModelBus → bool
-
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addAllHandlerFromOtherBus(
EventBus fromBus) → void -
Adds all handlers from another EventBus to this one.
inherited
-
createNode<
T> ({required Topic topic, T? currentData}) → EventNode< T> -
Creates the node for a topic.
inherited
-
currentData<
T> ({List< String> ? paths, String? separator}) → T? -
Gets the last data sent to a specific topic.
Returns null if no data has been sent to that topic.
inherited
-
dispose(
) → Future< void> -
Closes the all-events stream and every node of the bus.
Safe to call more than once; after dispose the bus throws StateError on use.
inherited
-
fire<
T> (T data, {List< String> ? paths, String? separator, Map<String, String> ? arguments}) → bool -
Publishes an event to local listeners without waiting for a handler.
inherited
-
handleIncomingRequest(
EventDTO dto) → Future -
Dispatches a request received from another process, for example a
transport.
inherited
-
handlerTopicFor(
Topic topic) → Topic? -
The registered topic of the handler that would answer
topic, or null when no handler accepts it.inherited -
haveHandler<
T> ({List< String> ? paths, String? separator}) → bool -
Returns true if the bus contains a handler for the specified topic
inherited
-
haveListener<
T> ({List< String> ? paths, String? separator}) → bool -
Checks if the bus contains a listener for the specified topic.
inherited
-
listen<
T> ({List< String> ? paths, String? separator}) → Stream<T> -
Listens to events on a specific topic.
Creates a new EventNode if one doesn't exist for that topic.
Returns a Stream of the data type T.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeAllHandlerPresentInOtherBus(
EventBus otherBus) → void -
Removes all handlers that are present in another EventBus from this one.
inherited
-
removeHandler<
T> ({List< String> ? paths, String? separator}) → void -
Removes a handler from a specific topic.
inherited
-
removeNode(
Topic topic, EventNode node) → bool -
This method is called every time a listener closes the stream.
The node is kept when it has listeners, a request handler, a pin from a
transport, or when this is a model bus.
inherited
-
request<
T> (T data, {List< String> ? paths, String? separator, Map<String, String> ? arguments, Duration? timeout}) → Future -
Sends a request and waits for the result of a handler.
inherited
-
setHandler<
T> ({T? initialData, List< String> ? paths, String? separator, required Handler<T> handler}) → void -
Sets a handler for a specific topic.
If initialData is provided, it will be used as the initial data for the topic.
inherited
-
shouldCreateNodeOnSend(
Topic topic) → bool -
Whether
sendshould create a node when the topic has none.inherited -
subscribe<
T> ({List< String> ? paths, String? separator, void onData(T e)?, Function? onError, void onDone()?, bool? cancelOnError}) → StreamSubscription<T> -
Subscribe to events on a specific topic.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited