Home > Back-end >  MissingPluginException(No implementation found for method init on channel com.ryanheise.just_audio.m
MissingPluginException(No implementation found for method init on channel com.ryanheise.just_audio.m

Time:11-05

I am building a desktop application using flutter where I need to play audio files from local storage and for this I am using just_audio flutter package since it supports Windows. But I Couldn't find any examples of it for windows. I have coded something like this-

import 'package:just_audio/just_audio.dart';
...

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
  final _player = AudioPlayer();

  @override
  void initState() {
    super.initState();
    ...
    _init();
  }
   
  Future<void> _init() async {
    await _Player.setFilePath('C:/Users/Admin/Downloads/test.wav', preload: true);
  }
  ...

The await call never finishes and I am getting the following error:

[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: MissingPluginException(No implementation found for method init on channel com.ryanheise.just_audio.methods)
#0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:165:7)
<asynchronous suspension>
#1      MethodChannelJustAudio.init (package:just_audio_platform_interface/method_channel_just_audio.dart:13:5)
<asynchronous suspension>
#2      AudioPlayer._setPlatformActive.setPlatform (package:just_audio/just_audio.dart:1255:13)
<asynchronous suspension>
#3      AudioPlayer.load (package:just_audio/just_audio.dart:708:26) 
<asynchronous suspension>
#4      AudioPlayer.setAudioSource (package:just_audio/just_audio.dart:683:18)
<asynchronous suspension>

CodePudding user response:

Hi If you have used some package, then after pub get try to restart app(Not hot restart, build it again) then it will work.

CodePudding user response:

just_audio doesn't include a Windows implementation. As it says in the README, you need to include another package such as just_audio_libwinmedia that provides a Windows implementation of the package.

  • Related