Home > Enterprise >  MissingPluginException on Flutter
MissingPluginException on Flutter

Time:12-11

I'm trying to open a URL but I get this Error, when I run an android app on the emulator or in a device the result on the screen is that nothing happens but I get "Unhandled Exception: MissingPluginException" , but when I use windows app woks fine.

launchUrl support: android,windows,ios

E/flutter ( 6260): [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) E/flutter ( 6260): #0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:294:7) E/flutter ( 6260): E/flutter ( 6260): #1 _launchURL (package:peliculas/screens/details_cast.dart:371:8) E/flutter ( 6260):

My code:

Future<void> _launchURL(String url) async {
  
  final Uri uri = Uri(scheme: "https", host: url);
  
  if (!await launchUrl(uri)) {
    throw 'Could not launch $url';
  }

-Im using url ="www.google.com" -emulator api 30

What I try before: - flutter clean - flutter pug get - flutter run - uninstall app - flutter doctor -v is OK - Im not using hot restart or hot reload

CodePudding user response:

run these commands in terminal

1 : $ flutter clean

2 : $ flutter pub get

3 : Restart your app

CodePudding user response:

You are using the url_launcher package which uses native device methods in order to work properly as also shown in the error

No implementation found for method launch on channel

So in order for this package to work properly. Kindly uninstall the old app on your phone and run the below commands

flutter clean

flutter pub get

After this run the app again and execute the _launchURL method/function, url will be launched without any error.

  • Related