removeListener method Null safety

  1. @override
void removeListener(
  1. ImageStreamListener listener
)
override

Stops the specified listener from receiving image stream events.

If listener has been added multiple times, this removes the first instance of the listener.

Once all listeners have been removed and all keepAlive handles have been disposed, this image stream is no longer usable.

Implementation

@override
void removeListener(ImageStreamListener listener) {
  super.removeListener(listener);
  if (!hasListeners) {
    _timer?.cancel();
    _timer = null;
  }
}