removeEventListener<T extends Event> method

void removeEventListener <T extends Event>(String eventType, EventListener<T> eventListener, { bool useCapture: false })

Removes an event listener to stop receiving events.

This style of removing an event listener is used for an easy migration from legacy ActionScript3 code to Dart code. In pure Dart code you should consider using the Dart style of removing event listenes like this:

Example:

// ActionScript3 style
sprite.removeEventListener(Event.ADDED_TO_STAGE, _onAddedToStage);
sprite.removeEventListener(MouseEvent.Click, _onMouseClick, useCapture: true);

// Dart style
_onAddedToStageSubscription.cancel();
_onMouseClickSubscription.cancale();

Implementation

void removeEventListener<T extends Event>(
    String eventType, EventListener<T> eventListener,
    {bool useCapture = false}) {
  var eventStream = this.on<T>(eventType);
  eventStream._unsubscribe(eventListener, useCapture);
}