playOrPause method

  1. @override
Future<RadioPlayerState> playOrPause()
override

Pauses if playback is requested, otherwise plays. Decided natively.

Implementation

@override
Future<RadioPlayerState> playOrPause() {
  calls.add('playOrPause');
  if (_state.sources.isNotEmpty) {
    if (_state.isPlaying) {
      _state = _state.copyWith(status: PlaybackStatus.paused, error: null);
    } else {
      _startPlaying();
    }
  }
  return _reply(_state);
}