If I calling AudioService.stop() isolate created from AudioService.start(backgroundTaskEntrypoint:...) won't kill.
So, after few showing/hiding media notification we have multiple unused isolates

Can you show me your onStop implementation?
@override
void onStop() {
AudioServiceBackground.setState(
controls: [],
basicState: BasicPlaybackState.stopped,
);
_playPauseCompleter?.complete();
}
_playPauseCompleter used in onStart like in your example
Correct @mrxten
This happens when running the example project.
The call stack gets piled up with multiple isolates if the audioservice is started and then stopped and repeated.
It seems that a brand new isolate is being created for every AudioService.start.
Not sure why this is happening but ideally the AudioService.stop should terminate the background isolate.
Steps to produce this bug:
I have also noticed that this seems to increase the memory in both debug and profile mode.
Thanks for clarifying. I had an open issue on this with the Flutter team when I first created the plugin, although it hasn't been answered yet. But I'll do some digging and see if I can figure out a solution.
This is now fixed in 0.5.7.
Most helpful comment
Thanks for clarifying. I had an open issue on this with the Flutter team when I first created the plugin, although it hasn't been answered yet. But I'll do some digging and see if I can figure out a solution.