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))
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';
}
}
)
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.