1

I want to create a hyperlink in Icon:

IconButton(
  icon: Icon(Icons.ac_unit,),
  onPressed: ()=>launch('https://github.com/himanshusharma89'),
)

How can we achieve this?

Error:

Exception has occurred.
MissingPluginException (MissingPluginException(No implementation found for method launch on channel plugins.flutter.io/url_launcher))
Himanshu Sharma
  • 984
  • 2
  • 15
  • 40

2 Answers2

3

Here is the solution, thanks to: Pavel

IconButton(
 icon: Icon(Icons.ac_unit,),
 onPressed: () async {
  const url = 'https://github.com/himanshusharma89';
  if (await canLaunch(url)) {
   await launch(url);
  } else {
   throw 'Could not launch $url';
  }
 }
)
Himanshu Sharma
  • 984
  • 2
  • 15
  • 40
0

The problem is that you have added dependency in pubspec.yaml and then just hot-reloaded the app. Native dependencies aren't added during hot reload. MissingPluginException means exactly that native (Android/iOS) plugin implementation is missed.

You should fully stop and start the app again

Pavel
  • 5,374
  • 4
  • 30
  • 55