EventEmitter class
Properties
-
count
→ int
-
Get the unique count of events registered in the emitter.
read-only
-
hashCode
→ int
-
The hash code for this object. [...]
read-only, inherited
-
runtimeType
→ Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
clear()
→ void
-
Clear all subscribers from the cache.
-
emit(String event, [ Object sender = null, Object data = null ])
→ void
-
API to emit events.
event is a required parameter.
If sender information is sent, it will be used to intimate user about it.
-
getListenersCount(String event)
→ int
-
Get the list of subscribers for a particular event.
-
off(Listener listener)
→ void
-
Remove event listener from emitter.
This will unsubscribe the caller from the emitter from any future events.
Listener should be a valid instance.
-
on(String event, Object context, EventCallback callback)
→ Listener
-
API to register for notification.
It is mandatory to pass event name and callback parameters.
-
removeAllByCallback(EventCallback callback)
→ void
-
Remove all listeners which matches with the callback provided.
It is possible to register for multiple events with a single callback.
This mechanism makesure that all event registrations would be cancelled which matches the callback.
-
removeAllByEvent(String event)
→ void
-
Use this mechanism to remove all subscription for a particular event.
Caution : This will remove all the listeners from multiple files or classes or modules.
Think twice before calling this API and make sure you know what you are doing!!!
-
removeListener(String eventName, EventCallback callback)
→ void
-
Unsubscribe from getting any future events from emitter.
This mechanism uses event name and callback to unsubscribe from all possible events.
-
noSuchMethod(Invocation invocation)
→ dynamic
-
Invoked when a non-existent method or property is accessed. [...]
inherited
-
toString()
→ String
-
Returns a string representation of this object.
inherited
Operators
-
operator ==(dynamic other)
→ bool
-
The equality operator. [...]
inherited