How can i include link in dart?

16 views Asked by At

I’m trying to use a url in dart language - flutter, but url_launcher has updated it’s functionalities, but it still doesn’t work, any recommendations ?

I tried the following code

_launchURL() async {
const url = 'https://www.google.com';
try {
if (await canLaunchUrl(Uri.parse(url))) {
await launchUrl(Uri.parse(url));
} else {
throw 'Could not launch $url';
}
} catch (e) {
print('Error launching URL: $e');
}
}

0

There are 0 answers