playOrPause method
Toggle the current playing state If the media player is playing, then pauses it If the media player has been paused, then play it
_assetsAudioPlayer.playOfPause();
Implementation
Future<void> playOrPause() async {
final playing = _isPlaying.valueOrNull ?? true;
if (playing) {
await pause();
} else {
await play();
}
}