ChicoBus<T> class
Tiny typed pub/sub for in-app events (not for cross-isolate work).
final bus = ChicoBus<String>();
final sub = bus.listen((msg) => print(msg));
bus.emit('hello');
sub.cancel();
For named channels, use ChicoChannels.
Constructors
- ChicoBus()
- Creates a bus.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clear(
) → void - Removes every listener.
-
emit(
T event) → void -
Delivers
eventto all listeners (copy of the list). -
listen(
void onEvent(T event)) → ChicoBusSubscription - Subscribes. Call ChicoBusSubscription.cancel when done.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited