togglePlayPause method

Future<void> togglePlayPause()

Toggle between play and pause

Implementation

Future<void> togglePlayPause() async {
  if (isPlaying) {
    await pause();
  } else {
    await play();
  }
}