Instance member 'mediaItem' can't be accessed using static access

56 views Asked by At

Can't undersand what i'm doing wrong. audio_service library.

void initState() {
    super.initState();
    AudioHandler.mediaItem.value((MediaItem? item) {
      setState(() {
        _currentMediaItem = item;
      });
    });
  }

issue: Instance member 'mediaItem' can't be accessed using static access.

I can't find anything about this in official documentation. In documentation of audio_service said what i need to identify variables as static. I was trying but can't fix that.

1

There are 1 answers

0
Mike On

Because mediaItem is a getter, and it's not a static getter. This is why you get the error.