i made one demo in flutter its work fine in Android, iphone, linux desktop and mac desktop but in windows desktop it give me error
[ERROR:c:\b\s\w\ir\cache\builder\src\flutter\lib\ui\ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method stop on channel xyz.luan/audioplayers)
can any one help me to resolve this error?
in this demo i used audioplayers 0.14.2 to play local audio file in flutter.
here is my code:-
void main() {
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
runApp(new MaterialApp(home: new ExampleApp()));
}
class ExampleApp extends StatefulWidget {
@override
_ExampleAppState createState() => new _ExampleAppState();
}
class _ExampleAppState extends State<ExampleApp> {
AudioPlayer advancedPlayer;
AudioCache audioCache;
@override
void initState() {
super.initState();
initPlayer();
}
void initPlayer() {
advancedPlayer = new AudioPlayer();
audioCache = new AudioCache(fixedPlayer: advancedPlayer);
}
void playfirst() {
audioCache.play('audio1.mp3');
}
void stop() {
advancedPlayer.stop();
}
@override
Widget build(BuildContext context) {
return DefaultTabController(
length: 1,
child: Scaffold(
appBar: AppBar(
title: Text('Audio file demo'),
),
body: Center(
child: Column(
children: <Widget>[
ButtonTheme(
minWidth: 48.0,
child: RaisedButton(child: Text("play"), onPressed: playfirst)),
ButtonTheme(
minWidth: 48.0,
child: RaisedButton(child: Text("stop"), onPressed: stop))
],
),
)
),
);
}
}