Launch url in flutter_widget_from_html

90 views Asked by At

Using flutter_widget_from_html, my html is rendering, but the links are not launching. I am using th url_launcher package and my code is below.

Am i doing something wrong?

 HtmlWidget('<p>This is a <a href="https://bbc.co.uk">link</a></p>', 
                onTapUrl: (url) => canLaunchUrl(Uri.parse(url)),
                renderMode: RenderMode.column,
                textStyle: TextStyle(fontSize: 20),
              )
1

There are 1 answers

0
Dhafin Rayhan On BEST ANSWER

canLaunchUrl is a function to check if the specified URL can be launched, and returns a boolean. To actually launch the URL, use launchUrl.

onTapUrl: (url) => launchUrl(Uri.parse(url)),