2

If anybody getting an issue in the audio_service library in flutter then this minor code may be helpful in fixing it

WillPopScope(
onWillPop: () async {
        await _audioHandler.stop();
        return true;
      },
child: Scaffold(...))
Muhammad Asif
  • 81
  • 1
  • 4
  • 1
    You've posted an answer as a question. Try instead to post a question as a question, then post an answer to your own question. But note, the `_cacheManager==null` assertion doesn't relate to `stop()`, it has to do with incorrectly calling `init` a second time. – Ryan Heise Mar 19 '22 at 02:13

1 Answers1

1

I got this error because I initialized just_audio_background and audio_service package at the same time.

Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77