addListener method

AsyncEventEmitter addListener(
  1. String event,
  2. Handler listener
)

Adds the listener function to the end of the listeners array for the given event. The listeners will be called in order but if they are asynchronous they may run concurrently. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of event and listener will result in the listener being added, and called, multiple times. @param event The event to add the listener to. @param listener The listener to add. @returns A reference to the AsyncEventEmitter, so that calls can be chained.

Implementation

AsyncEventEmitter addListener(String event, Handler<dynamic> listener) {
  final listeners = _getListeners(event);
  listeners.add(listener);
  _assignListeners(event, listeners);
  return this;
}