Skip to content

Instantly share code, notes, and snippets.

@ketan-glitch
Created July 16, 2021 12:48
Show Gist options
  • Save ketan-glitch/d31a6bff83f6da7721868a933115f77d to your computer and use it in GitHub Desktop.
Save ketan-glitch/d31a6bff83f6da7721868a933115f77d to your computer and use it in GitHub Desktop.
Future<void> _launchWebsite(String url) async {
if (!(url.startsWith('http'))) {
if (!(url.startsWith('https://'))) {
url = 'https://' + url;
}
}
if (await canLaunch(url)) {
await launch(
url,
forceSafariVC: false,
forceWebView: false,
// headers: <String, String>{'my_header_key': 'my_header_value'},
);
} else {
print('Could not launch $url');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment