Closed yagoliveira92 closed 5 years ago
@override void initState() { super.initState(); audioStart(); }
Future
I see that in the exemple, but don't work. I think: How the audio can be start if I don't pass the streamUrl
in parameters?
I try modify the Dart Code like that:
String streaming = "https://azuracast.tecnocampinfo.com.br/radio/8000/listen.mp3";
@override
void initState() {
super.initState();
audioStart(streaming);
}
Future<void> audioStart(url) async {
await FlutterRadio.play(url: url);
print('Audio Start OK');
}
But I got that error:
E/flutter (20068): [ERROR:flutter/shell/common/shell.cc(184)] Dart Error: Unhandled exception:
E/flutter (20068): PlatformException(error, lateinit property radioManager has not been initialized, null)
I resolved creating one metod
Future<void> audioOnInit() async {
await FlutterRadio.play(url: streamUrl);
print('Audio Start On Init OK');
}
and calling this metod in initState()
@override
void initState() {
super.initState();
audioStart();
audioOnInit();
}
Thanks =D
How can I start audio on
initState
?