togglePlayPause method

Future<void> togglePlayPause()

Implementation

Future<void> togglePlayPause() async {
  final isPlaying = await _key.currentState?.isPlaying();
  if (isPlaying == true) {
    await pause();
  } else {
    await play();
  }
}