EventStream<T> on<T extends Event>(String eventType)

Returns an event stream of type eventType.

This accessor should only be used when an explicit accessor is not available, e.g. for custom events:

sprite.onAddedToStage.listen(_onAddedToStage);
sprite.onMouseClick.capture(_onMouseClick);
sprite.on("CustomEvent").listen(_onCustomEvent);

Source

EventStream<T> on<T extends Event>(String eventType) {

  var eventStreams = _eventStreams;
  if (eventStreams == null) {
    eventStreams = new Map<String, EventStream<Event>>();
    _eventStreams = eventStreams;
  }

  var eventStream = eventStreams[eventType];
  if (eventStream == null) {
    eventStream = new EventStream<T>._(this, eventType);
    eventStreams[eventType] = eventStream;
  }

  return eventStream;
}