removeListener method

Future<void> removeListener()

Cancels the volume listener.

Implementation

Future<void> removeListener() async {
  final listener = _volumeListener;
  if (listener == null) {
    return;
  }

  await listener.cancel();

  // addListener may have replaced this subscription during the await.
  if (!identical(_volumeListener, listener)) {
    return;
  }

  _volumeListener = null;
  _volumeStream = null;
}