Home > Back-end >  ERROR:flutter/runtime/dart_vm_initializer.cc(41) on url_launcher
ERROR:flutter/runtime/dart_vm_initializer.cc(41) on url_launcher

Time:12-22

I use HTTP launcher and found this error on my console log after I run debug on my android studio emulator:

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: MissingPluginException(No implementation found for method launch on channel plugins.flutter.io/url_launcher_android)

This is the code where it throw error:

Future<void> _launchMap() async {
    final url = widget.website;
    var uri = Uri.parse(url);
    if (!await launchUrl(uri)) {
      throw 'Could not launch';
    }
  }

this is my android manifest:

       <queries>
            <!-- If your app checks for call support -->
            <intent>
                <action android:name="android.intent.action.VIEW" />
                <data android:scheme="tel" />
            </intent>
            <intent>
                <action android:name="android.intent.action.VIEW" />
                <data android:scheme="https" />
            </intent>
        </queries>

I use the newest flutter version and I already follow the guide from https://pub.dev/packages/url_launcher, but it still can't direct the link that I want from my API

CodePudding user response:

If you are using hot restart or hot reload, it won't do the trick. Since Flutter has to inject plugin dependencies into the platform-specific parts of your app, hot restart/hot reload is not enough to trigger the injection. Check this issue for more.

Close the app and execute flutter run command.

CodePudding user response:

Try below code

Future<void> _launchMap() async {
       final url = widget.website;
       var uri = Uri.parse(url);
    if (await canLaunchUrl(url)) {
       await launchUrl(url);
   } else {
       throw 'Could not launch $url';
}}
  • Related