diff --git a/add_to_app/android_view/flutter_module_using_plugin/lib/main.dart b/add_to_app/android_view/flutter_module_using_plugin/lib/main.dart index 9f05dd368..ff9cca454 100644 --- a/add_to_app/android_view/flutter_module_using_plugin/lib/main.dart +++ b/add_to_app/android_view/flutter_module_using_plugin/lib/main.dart @@ -165,9 +165,9 @@ class Contents extends StatelessWidget { 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'), diff --git a/add_to_app/multiple_flutters/multiple_flutters_module/lib/main.dart b/add_to_app/multiple_flutters/multiple_flutters_module/lib/main.dart index b65a641b5..235f10932 100644 --- a/add_to_app/multiple_flutters/multiple_flutters_module/lib/main.dart +++ b/add_to_app/multiple_flutters/multiple_flutters_module/lib/main.dart @@ -95,9 +95,9 @@ class _MyHomePageState extends State { 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'), diff --git a/add_to_app/plugin/flutter_module_using_plugin/lib/main.dart b/add_to_app/plugin/flutter_module_using_plugin/lib/main.dart index 388821fed..8a162ec0a 100644 --- a/add_to_app/plugin/flutter_module_using_plugin/lib/main.dart +++ b/add_to_app/plugin/flutter_module_using_plugin/lib/main.dart @@ -164,9 +164,9 @@ class Contents extends StatelessWidget { 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'), diff --git a/desktop_photo_search/fluent_ui/lib/src/widgets/policy_dialog.dart b/desktop_photo_search/fluent_ui/lib/src/widgets/policy_dialog.dart index 47cabd34a..253903b8b 100644 --- a/desktop_photo_search/fluent_ui/lib/src/widgets/policy_dialog.dart +++ b/desktop_photo_search/fluent_ui/lib/src/widgets/policy_dialog.dart @@ -29,9 +29,10 @@ class PolicyDialog extends StatelessWidget { fontWeight: FontWeight.bold, color: Colors.blue.normal), recognizer: TapGestureRecognizer() ..onTap = () async { - const url = 'https://policies.google.com/terms'; - if (await url_launcher.canLaunch(url)) { - await url_launcher.launch(url); + final url = + Uri.parse('https://policies.google.com/terms'); + if (await url_launcher.canLaunchUrl(url)) { + await url_launcher.launchUrl(url); } }, ) @@ -50,9 +51,9 @@ class PolicyDialog extends StatelessWidget { fontWeight: FontWeight.bold, color: Colors.blue.normal), recognizer: TapGestureRecognizer() ..onTap = () async { - const url = 'https://unsplash.com/terms'; - if (await url_launcher.canLaunch(url)) { - await url_launcher.launch(url); + final url = Uri.parse('https://unsplash.com/terms'); + if (await url_launcher.canLaunchUrl(url)) { + await url_launcher.launchUrl(url); } }, ) diff --git a/desktop_photo_search/fluent_ui/lib/src/widgets/unsplash_notice.dart b/desktop_photo_search/fluent_ui/lib/src/widgets/unsplash_notice.dart index 57484f6e1..c4e98608c 100644 --- a/desktop_photo_search/fluent_ui/lib/src/widgets/unsplash_notice.dart +++ b/desktop_photo_search/fluent_ui/lib/src/widgets/unsplash_notice.dart @@ -8,10 +8,10 @@ import 'package:url_launcher/url_launcher.dart'; import '../../unsplash_access_key.dart'; -final _unsplashHomepage = - 'https://unsplash.com/?utm_source=${Uri.encodeFull(unsplashAppName)}&utm_medium=referral'; -final _unsplashPrivacyPolicy = - 'https://unsplash.com/privacy?utm_source=${Uri.encodeFull(unsplashAppName)}&utm_medium=referral'; +final _unsplashHomepage = Uri.parse( + 'https://unsplash.com/?utm_source=${Uri.encodeFull(unsplashAppName)}&utm_medium=referral'); +final _unsplashPrivacyPolicy = Uri.parse( + 'https://unsplash.com/privacy?utm_source=${Uri.encodeFull(unsplashAppName)}&utm_medium=referral'); class UnsplashNotice extends StatefulWidget { const UnsplashNotice({Key? key, required this.child}) : super(key: key); @@ -64,7 +64,7 @@ class _UnsplashDialog extends StatelessWidget { text: 'Unsplash', recognizer: TapGestureRecognizer() ..onTap = () async { - if (!await launch(_unsplashHomepage)) { + if (!await launchUrl(_unsplashHomepage)) { throw 'Could not launch $_unsplashHomepage'; } }, @@ -81,7 +81,7 @@ class _UnsplashDialog extends StatelessWidget { text: 'how Unsplash collects and uses data', recognizer: TapGestureRecognizer() ..onTap = () async { - if (!await launch(_unsplashPrivacyPolicy)) { + if (!await launchUrl(_unsplashPrivacyPolicy)) { throw 'Could not launch $_unsplashPrivacyPolicy'; } }, diff --git a/desktop_photo_search/material/lib/src/widgets/policy_dialog.dart b/desktop_photo_search/material/lib/src/widgets/policy_dialog.dart index 409bdbec7..d6dd6f8e9 100644 --- a/desktop_photo_search/material/lib/src/widgets/policy_dialog.dart +++ b/desktop_photo_search/material/lib/src/widgets/policy_dialog.dart @@ -29,9 +29,10 @@ class PolicyDialog extends StatelessWidget { fontWeight: FontWeight.bold, color: Colors.lightBlue), recognizer: TapGestureRecognizer() ..onTap = () async { - const url = 'https://policies.google.com/terms'; - if (await url_launcher.canLaunch(url)) { - await url_launcher.launch(url); + final url = + Uri.parse('https://policies.google.com/terms'); + if (await url_launcher.canLaunchUrl(url)) { + await url_launcher.launchUrl(url); } }, ) @@ -50,9 +51,9 @@ class PolicyDialog extends StatelessWidget { fontWeight: FontWeight.bold, color: Colors.lightBlue), recognizer: TapGestureRecognizer() ..onTap = () async { - const url = 'https://unsplash.com/terms'; - if (await url_launcher.canLaunch(url)) { - await url_launcher.launch(url); + final url = Uri.parse('https://unsplash.com/terms'); + if (await url_launcher.canLaunchUrl(url)) { + await url_launcher.launchUrl(url); } }, ) diff --git a/desktop_photo_search/material/lib/src/widgets/unsplash_notice.dart b/desktop_photo_search/material/lib/src/widgets/unsplash_notice.dart index 7012ac6ab..d14c7c61a 100644 --- a/desktop_photo_search/material/lib/src/widgets/unsplash_notice.dart +++ b/desktop_photo_search/material/lib/src/widgets/unsplash_notice.dart @@ -8,10 +8,10 @@ import 'package:url_launcher/url_launcher.dart'; import '../../unsplash_access_key.dart'; -final _unsplashHomepage = - 'https://unsplash.com/?utm_source=${Uri.encodeFull(unsplashAppName)}&utm_medium=referral'; -final _unsplashPrivacyPolicy = - 'https://unsplash.com/privacy?utm_source=${Uri.encodeFull(unsplashAppName)}&utm_medium=referral'; +final _unsplashHomepage = Uri.parse( + 'https://unsplash.com/?utm_source=${Uri.encodeFull(unsplashAppName)}&utm_medium=referral'); +final _unsplashPrivacyPolicy = Uri.parse( + 'https://unsplash.com/privacy?utm_source=${Uri.encodeFull(unsplashAppName)}&utm_medium=referral'); class UnsplashNotice extends StatefulWidget { const UnsplashNotice({Key? key, required this.child}) : super(key: key); @@ -65,7 +65,7 @@ class _UnsplashDialog extends StatelessWidget { text: 'Unsplash', recognizer: TapGestureRecognizer() ..onTap = () async { - if (!await launch(_unsplashHomepage)) { + if (!await launchUrl(_unsplashHomepage)) { throw 'Could not launch $_unsplashHomepage'; } }, @@ -82,7 +82,7 @@ class _UnsplashDialog extends StatelessWidget { text: 'how Unsplash collects and uses data', recognizer: TapGestureRecognizer() ..onTap = () async { - if (!await launch(_unsplashPrivacyPolicy)) { + if (!await launchUrl(_unsplashPrivacyPolicy)) { throw 'Could not launch $_unsplashPrivacyPolicy'; } },