I use the package url_launcher to open url, here is the code:
Future <void> _openURL(String url) async{
if(await canLaunch(url)) {
await launch(
url,
forceSafariVC: false,
forceWebView: true,
);
}
else{
throw 'Cant open URL';
}
}
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'
I get the same error: Unhandled Exception: Could not launch
As you can see here https://pub.dev/packages/url_launcher you have to put the following snippet at your AndroidManifest.xml
<queries>
<!-- If your app opens https URLs -->
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="https" />
</intent>
</queries>