Listener<T> class

Listener is one who listen for specific event. Listener register for notification with EventEmitter Once the listener is registered, a Listener interface is returned back to the caller. Caller can use this Listener interface to cancel the registration or check the state.

Constructors

Listener(T event, EventCallback _callback, CancelEvent? _cancelCallback)
Constructor for Listener. This will take four arguments. event, callback are mandatory. _cancelCallback is optional. if _cancelCallback callback is provided, then the listener can use that to cancel the subscription.
Listener.Default(T event, EventCallback _callback)
Constructor for Listener. This will take four arguments. event, callback are mandatory.

Properties

callback EventCallback
no setter
event → T
The event, the subscriber subscribed to.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

cancel() bool
Cancel the event subscription with the subject. Eventhough the cancel method is called, listener doesn't check the cancellation of the subscription. Subscription cancellation shall be implemented in the _cancelCallback function. The Default constructor doesn't provide a mechanism to cancel the subscription. Use the EventEmitter.on to cancel the suscrition effectively. Returns true, if _cancelCallback is successfully executed, false otherwise.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
updateCallback(EventCallback callback) → void

Operators

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