dispatchEvent method

EventTarget dispatchEvent(
  1. Event event
)

Emit an event. @return The self object, for chainability.

Implementation

EventTarget dispatchEvent(Event event){
  if (_listeners == null) {
    return this;
  }

  final listeners = _listeners;
  final listenerArray = listeners?[event.type];
  //print(event.type);
  if (listenerArray != null) {
    //print(event.type);
    event.target = this;
    for (int i = 0, l = listenerArray.length; i < l; i++) {
      //print('LISTEN: ${listenerArray[i]}');
      listenerArray[i].call(event);
    }
  }
  return this;
}