prependListener method

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

Adds the listener function to the beginning 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 prepend the listener to. @param listener The listener to prepend. @returns A reference to the AsyncEventEmitter, so that calls can be chained.

Implementation

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