pause method Null safety

Future<void> pause()

Pauses the currently playing media. This method does nothing if ![playing].

Implementation

Future<void> pause() async {
  if (_disposed) return;
  if (!playing) return;
  //_setPlatformActive(true);
  _playInterrupted = false;
  // Update local state immediately so that queries aren't surprised.
  _playbackEvent = _playbackEvent.copyWith(
    updatePosition: position,
    updateTime: DateTime.now(),
  );
  _playingSubject.add(false);
  _playbackEventSubject.add(_playbackEvent);
  // TODO: perhaps modify platform side to ensure new state is broadcast
  // before this method returns.
  await (await _platform).pause(PauseRequest());
}