Future<void> _openURL(String url) async {
if (await canLaunch(url)) {
await launch(url, forceSafariVC: false, forceWebView: true);
}
ListTile(
title: Text('Google'),
onTap: () {
_openURL('https://www.google.de/');
},
);
But no matter what url i want to open, i get the error ‘Cant open URL’
2
Answers
I don’t know which package are you using for url, but for me the flutter package works fine
Then, just launch the url like this:
Maybe your error depends on the fact that you’re using a String and not a Uri type in the function.
Try using the package i told you with the function i provided you.
try adding this
Uri.parse(url)
await launch(Uri.parse(url), forceSafariVC: false, forceWebView: true);