1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-08 13:58:47 +00:00

Update for url_launcher API change (#1144)

This commit is contained in:
Brett Morgan
2022-04-26 07:17:15 +10:00
committed by GitHub
parent 2db0b4bf55
commit ed2a422e2a
7 changed files with 35 additions and 33 deletions

View File

@@ -95,9 +95,9 @@ class _MyHomePageState extends State<MyHomePage> {
onPressed: () async {
// Use the url_launcher plugin to open the Flutter docs in
// a browser.
const url = 'https://flutter.dev/docs';
if (await launcher.canLaunch(url)) {
launcher.launch(url);
final url = Uri.parse('https://flutter.dev/docs');
if (await launcher.canLaunchUrl(url)) {
launcher.launchUrl(url);
}
},
child: const Text('Open Flutter Docs'),