I'm working with the audio_service package in Flutter, and I'm trying to use the _audioHandler variable in my code. However, when I try to run the app, I get the following error message:
LateInitializationError: Field '_audioHandler' has not been initialized
I've tried initializing the AudioHandler before using it, but I still get the same error. I'm not sure what's causing the problem.
I run this player from audioscreen.dart like this :
await Navigator.push(context, MaterialPageRoute(
builder: (context) =>
audio_play(),
),
);
audio_play(), function i call it from audioPlay.dart
The code in audioPlay.dart
I hope I have stated the problem clearly
I expected was that the AudioHandler would be properly initialized and that I would be able to use the _audioHandler variable without any issues. However, what actually happened was that I got a runtime error that prevented me from using this
Can anyone suggest a solution to this problem, or provide guidance on how I can properly initialize the AudioHandler in my code?