I'm trying to implement a "play next"/"add to queue" feature in my app. This is what I currently have:
final ConcatenatingAudioSource _queue = ConcatenatingAudioSource();
Future<void> addNextToQueue(String url) async {
await _queue!.insert(
_player.nextIndex!,
AudioSource.uri(...),
);
}
This approach works only if shuffle mode is disabled, otherwise track gets added somewhere else. How can I fix that?
Other solutions I've tried for _queue!.insert first argument were:
_player.currentIndex! + 1
_player.effectiveIndices![_player.nextIndex!]