Search code examples
androidflutterdarticons

How to create hyperlink icon in flutter?


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))

Solution

  • 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';
      }
     }
    )