Listening the Song End in audio players

Viewed 28

I wanna ask is there any stream to listen when the song get ended to do some stuff at that point in audioplayers flutter package or is there any method to do that ?

1 Answers

You should listen the event AudioPlayer.onPlayerComplete.

From the docs:

Events are sent every time an audio is finished, therefore no event is sent when an audio is paused or stopped.

It'd be something like:

audioPlayer.onPlayerComplete.listen((event) {
  // Do something
});
Related