Publisher<Message> class

Observer Pattern - Publisher

  • A Publisher is a subject that publishes messages to subscribers.
  • A Subscriber is an observer that subscribes to a publisher.

Subscribers can be notified when a message is published.

Constructors

Publisher.new()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
subscribers List<Subscriber<Message>>
List of subscribers to be notified when a message is published.
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
publish(Message message) → void
Publishes a message to all subscribers.
subscribe(Subscriber<Message> subscriber) → void
Subscribes a subscriber to this publisher.
toString() String
A string representation of this object.
inherited
unsubscribe(Subscriber<Message> subscriber) → void
Unsubscribes a subscriber from this publisher.

Operators

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