removeEventListener<T extends Event> method

void removeEventListener<T extends Event>(
  1. String eventType,
  2. EventListener<T> eventListener,
  3. {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:


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

// Dart style


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