Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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(() {});
});
like image 467
vaibhav bhapkar Avatar asked Oct 31 '25 20:10

vaibhav bhapkar


1 Answers

  if (event == PlayerState.PLAYING) {
like image 56
Singh Avatar answered Nov 03 '25 12:11

Singh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!