0

[here is the write and gesture detector code](https://i.stack.imgur.com/RmUfF.png)

I tried adding this but it didnt work . i just want when i click on the music button it should play the background audio in assets and if click on no music it should stop the background music. but that state should be maintained after applying.

 void initState(){
    super.initState();

    setAudio();

    audioPlayer.onPlayerStateChanged.listen((state) {
      setState(() {
        isPlaying = state == PlayerState.PLAYING;
      });
    });

   

0 Answers0