title: How to update notification display from inside a function
body: <p>I'm using audio_service and just_audio on my flutter app which is a radio player and
  I'm having trouble updating the mediaItem on the notification.</p>
  <p>When I call mediaItem.add(item) from within play() or pause() it works fine
  but when I try the same from inside a function (the one I use to modify the mediaItem in the first place) it doesn't update</p>
  <p>code examples :</p>
  <pre><code>  @override
    Future&lt;void&gt; play() async {
      mediaItem.add(item);
      _player.play();
    }
  </code></pre>
  <p>There it works, the notification shows the updated item</p>
  <p>but if I call :</p>
  <pre><code>updateMediaItems(String album, String title, String artist, String coverUrl) async {
      
        item = MediaItem(
          id: 1,
          album: album,
          title: title,
          artist: artist,
          artUri: Uri.parse(coverUrl),
        );
      }
      mediaItem.add(item);
  }
  </code></pre>
  <p>The item itself is correctly updated but not displayed in the notification
  If someone can help me understand where is the issue, I been looking around and tried a lot but didn't get it (it's my first app using flutter)</p>
  <p>UPDATE :</p>
  <p>I just tried to call the function from inside my play() function like so :</p>
  <pre><code>@override
    Future&lt;void&gt; play() async {
      updateMediaItems('','test title','','default');
      _player.play();
    }
  </code></pre>
  <p>And by doing so it works.</p>
  <p>LAST UPDATE</p>
  <p>I tried calling the function from inside my AudioHandler class and it works. It seems the problem was that I was calling it from my PageManager class. I don't really get why, if someone can explain it to me it'll be nice but at least I got it to work</p>