Flutter error: the getter 'AudioPlayerState' isn't defined for the class '_HomePageState'

1,144
  if (event == PlayerState.PLAYING) {
Share:
1,144
vaibhav bhapkar
Author by

vaibhav bhapkar

Updated on December 29, 2022

Comments

  • vaibhav bhapkar
    vaibhav bhapkar over 1 year

    I have imported audioplayer.dart but it is still showing me the error: the getter 'AudioPlayerState' isn't defined for the class '_HomePageState'

    import 'package:audioplayers/audioplayers.dart';
    _audioPlayer.onPlayerStateChanged.listen((event) {
      if (event == AudioPlayerState.PLAYING) {
        _isPlaying = true;
      } else {
        _isPlaying = false;
      }
      setState(() {});
    });
    
    • Nisanth Reddy
      Nisanth Reddy almost 3 years
      Hi There. This is not the code that is causing the issue. Post your full code.