Home > Enterprise >  Flutter assests_audio_player import doesn't work
Flutter assests_audio_player import doesn't work

Time:03-03

My flutter has suddenly started giving me this error on assets_audio_player : "Undefined class 'AssetsAudioPlayer'.". The import for the player: import 'package:assets_audio_player/assets_audio_player.dart'; is also greyed out. I've tried upgrading the flutter & restarting the device but the issue is still there. Any clue what might've gone wrong? Thank you!

CodePudding user response:

Before importing the package in your code, did you properly add its dependency in your "pubspec.yaml" file and then run the flutter pub get command?

CodePudding user response:

I am guessing you're using this package. Be sure to add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get).

dependencies:
  assets_audio_player: ^3.0.4 1
  • Related