toggleLoop method
toggle the looping state if it was looping -> stops this if it was'nt looping -> now it is
Implementation
Future<void> toggleLoop() async {
if (_playlist != null) {
final currentMode = loopMode.value;
if (_playlist!.isSingleAudio) {
if (currentMode == LoopMode.none) {
await setLoopMode(LoopMode.single);
} else {
await setLoopMode(LoopMode.none);
}
} else {
if (currentMode == LoopMode.none) {
await setLoopMode(LoopMode.playlist);
} else if (currentMode == LoopMode.playlist) {
await setLoopMode(LoopMode.single);
} else {
await setLoopMode(LoopMode.none);
}
}
}
}