playNext method
Play next track in queue
Implementation
Future<void> playNext() async {
if (_queue.isEmpty) {
if (_repeatMode == RepeatMode.queue && _history.isNotEmpty) {
_queue.addAll(_history);
_history.clear();
_queueController.add(List.from(_queue));
} else {
LavalinkLogger.info('Queue is empty, stopping', tag: 'Player');
await stop();
return;
}
}
final nextTrack = _queue.removeAt(0);
_queueController.add(List.from(_queue));
await play(nextTrack, addToHistory: true);
}