From 1248e1259dc9432c5bf947fcfc56bae4ec198487 Mon Sep 17 00:00:00 2001 From: Devesh Pal Date: Sun, 26 Jun 2022 19:14:56 +0530 Subject: [PATCH 01/10] Update README.md --- packages/url_launcher/url_launcher/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/url_launcher/url_launcher/README.md b/packages/url_launcher/url_launcher/README.md index 9ef6b5aac5c7..5f78fa7b9bf6 100644 --- a/packages/url_launcher/url_launcher/README.md +++ b/packages/url_launcher/url_launcher/README.md @@ -24,7 +24,7 @@ void main() => runApp( const MaterialApp( home: Material( child: Center( - child: RaisedButton( + child: ElevatedButton( onPressed: _launchUrl, child: Text('Show Flutter homepage'), ), From 72269777b0112d7168e0d3b31b451d445ca9ac1a Mon Sep 17 00:00:00 2001 From: David Iglesias Teixeira Date: Wed, 6 Jul 2022 14:00:45 -0700 Subject: [PATCH 02/10] Add build.excerpt.yaml and deps. Update CHANGELOG. --- packages/url_launcher/url_launcher/CHANGELOG.md | 4 ++++ .../url_launcher/example/build.excerpt.yaml | 15 +++++++++++++++ .../url_launcher/example/pubspec.yaml | 1 + packages/url_launcher/url_launcher/pubspec.yaml | 2 +- 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 packages/url_launcher/url_launcher/example/build.excerpt.yaml diff --git a/packages/url_launcher/url_launcher/CHANGELOG.md b/packages/url_launcher/url_launcher/CHANGELOG.md index e5e98f658617..c6e4b9aed8b3 100644 --- a/packages/url_launcher/url_launcher/CHANGELOG.md +++ b/packages/url_launcher/url_launcher/CHANGELOG.md @@ -1,3 +1,7 @@ +## 6.1.5 + +* Migrates `README.md` examples to the [`code-excerpt` system](https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#readme-code). + ## 6.1.4 * Adopts new platform interface method for launching URLs. diff --git a/packages/url_launcher/url_launcher/example/build.excerpt.yaml b/packages/url_launcher/url_launcher/example/build.excerpt.yaml new file mode 100644 index 000000000000..e317efa11cb3 --- /dev/null +++ b/packages/url_launcher/url_launcher/example/build.excerpt.yaml @@ -0,0 +1,15 @@ +targets: + $default: + sources: + include: + - lib/** + # Some default includes that aren't really used here but will prevent + # false-negative warnings: + - $package$ + - lib/$lib$ + exclude: + - '**/.*/**' + - '**/build/**' + builders: + code_excerpter|code_excerpter: + enabled: true diff --git a/packages/url_launcher/url_launcher/example/pubspec.yaml b/packages/url_launcher/url_launcher/example/pubspec.yaml index 43b5265c45ec..f459dc5bdbdc 100644 --- a/packages/url_launcher/url_launcher/example/pubspec.yaml +++ b/packages/url_launcher/url_launcher/example/pubspec.yaml @@ -18,6 +18,7 @@ dependencies: path: ../ dev_dependencies: + build_runner: ^2.1.10 flutter_driver: sdk: flutter integration_test: diff --git a/packages/url_launcher/url_launcher/pubspec.yaml b/packages/url_launcher/url_launcher/pubspec.yaml index e01cd9b7a4f7..03d0846bf173 100644 --- a/packages/url_launcher/url_launcher/pubspec.yaml +++ b/packages/url_launcher/url_launcher/pubspec.yaml @@ -3,7 +3,7 @@ description: Flutter plugin for launching a URL. Supports web, phone, SMS, and email schemes. repository: https://github.com/flutter/plugins/tree/main/packages/url_launcher/url_launcher issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+url_launcher%22 -version: 6.1.4 +version: 6.1.5 environment: sdk: ">=2.14.0 <3.0.0" From 8d3c9eaeae4571b6e323916c6a9eaf7a1a2a4afa Mon Sep 17 00:00:00 2001 From: David Iglesias Teixeira Date: Fri, 8 Jul 2022 13:09:04 -0700 Subject: [PATCH 03/10] Configure excerpter so it can find Android XML files --- .../url_launcher/url_launcher/example/build.excerpt.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/url_launcher/url_launcher/example/build.excerpt.yaml b/packages/url_launcher/url_launcher/example/build.excerpt.yaml index e317efa11cb3..c9a9c71ba14f 100644 --- a/packages/url_launcher/url_launcher/example/build.excerpt.yaml +++ b/packages/url_launcher/url_launcher/example/build.excerpt.yaml @@ -3,6 +3,7 @@ targets: sources: include: - lib/** + - android/app/src/main/** # Some default includes that aren't really used here but will prevent # false-negative warnings: - $package$ @@ -10,6 +11,10 @@ targets: exclude: - '**/.*/**' - '**/build/**' + - 'android/app/src/main/res/**' builders: code_excerpter|code_excerpter: enabled: true + generate_for: + - '**/*.dart' + - android/**/*.xml From 8d4d5d2b2b16c5ab448c5aecc833419bbd0e0b60 Mon Sep 17 00:00:00 2001 From: David Iglesias Teixeira Date: Fri, 8 Jul 2022 13:09:40 -0700 Subject: [PATCH 04/10] Add docregions --- .../android/app/src/main/AndroidManifest.xml | 4 ++ .../url_launcher/example/lib/basic.dart | 34 +++++++++ .../url_launcher/example/lib/encoding.dart | 69 +++++++++++++++++++ .../url_launcher/example/lib/files.dart | 44 ++++++++++++ .../url_launcher/example/pubspec.yaml | 1 + 5 files changed, 152 insertions(+) create mode 100644 packages/url_launcher/url_launcher/example/lib/basic.dart create mode 100644 packages/url_launcher/url_launcher/example/lib/encoding.dart create mode 100644 packages/url_launcher/url_launcher/example/lib/files.dart diff --git a/packages/url_launcher/url_launcher/example/android/app/src/main/AndroidManifest.xml b/packages/url_launcher/url_launcher/example/android/app/src/main/AndroidManifest.xml index 5c0d0afa0fe4..da5ddfdc1561 100644 --- a/packages/url_launcher/url_launcher/example/android/app/src/main/AndroidManifest.xml +++ b/packages/url_launcher/url_launcher/example/android/app/src/main/AndroidManifest.xml @@ -7,21 +7,25 @@ --> + + + + runApp( + const MaterialApp( + home: Material( + child: Center( + child: ElevatedButton( + onPressed: _launchUrl, + child: Text('Show Flutter homepage'), + ), + ), + ), + ), + ); + +Future _launchUrl() async { + if (!await launchUrl(_url)) { + throw 'Could not launch $_url'; + } +} +// #enddocregion basic-example diff --git a/packages/url_launcher/url_launcher/example/lib/encoding.dart b/packages/url_launcher/url_launcher/example/lib/encoding.dart new file mode 100644 index 000000000000..251f24f23ac0 --- /dev/null +++ b/packages/url_launcher/url_launcher/example/lib/encoding.dart @@ -0,0 +1,69 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Run this example with: flutter run -t lib/encoding.dart -d emulator + +// This file is used to extract code samples for the README.md file. +// Run update-excerpts if you modify this file. + +import 'package:flutter/material.dart'; +import 'package:url_launcher/url_launcher.dart'; + +/// Encode [params] so it produces a correct query string. +/// Workaround for: https://github.com/dart-lang/sdk/issues/43838 +// #docregion encode-query-parameters +String? encodeQueryParameters(Map params) { + return params.entries + .map((MapEntry e) => '${Uri.encodeComponent(e.key)}=${Uri.encodeComponent(e.value)}') + .join('&'); +} +// #enddocregion encode-query-parameters + +void main() => runApp( + MaterialApp( + home: Material( + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: const [ + ElevatedButton( + onPressed: _composeMail, + child: Text('Compose an email'), + ), + ElevatedButton( + onPressed: _composeSms, + child: Text('Compose a SMS'), + ), + ], + ), + ), + ), + ); + +void _composeMail() { +// #docregion encode-query-parameters + final Uri emailLaunchUri = Uri( + scheme: 'mailto', + path: 'smith@example.com', + query: encodeQueryParameters({ + 'subject': 'Example Subject & Symbols are allowed!' + }), + ); + + launchUrl(emailLaunchUri); +// #enddocregion encode-query-parameters +} + +void _composeSms() { +// #docregion sms + final Uri smsLaunchUri = Uri( + scheme: 'sms', + path: '0118 999 881 999 119 7253', + queryParameters: { + 'body': Uri.encodeComponent('Example Subject & Symbols are allowed!'), + }, + ); +// #enddocregion sms + + launchUrl(smsLaunchUri); +} diff --git a/packages/url_launcher/url_launcher/example/lib/files.dart b/packages/url_launcher/url_launcher/example/lib/files.dart new file mode 100644 index 000000000000..44689dd5d281 --- /dev/null +++ b/packages/url_launcher/url_launcher/example/lib/files.dart @@ -0,0 +1,44 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Run this example with: flutter run -t lib/files.dart -d linux + +// This file is used to extract code samples for the README.md file. +// Run update-excerpts if you modify this file. +import 'dart:io'; + +import 'package:flutter/material.dart'; +import 'package:path/path.dart' as p; +import 'package:url_launcher/url_launcher.dart'; + +void main() => runApp( + const MaterialApp( + home: Material( + child: Center( + child: ElevatedButton( + onPressed: _openFile, + child: Text('Open File'), + ), + ), + ), + ), + ); + +Future _openFile() async { + // Prepare a file within tmp + final String tempFilePath = p.joinAll([...p.split(Directory.systemTemp.path), 'flutter_url_launcher_example.txt']); + final File testFile = File(tempFilePath); + await testFile.writeAsString('Hello, world!'); +// #docregion file + final String filePath = testFile.absolute.path; + final Uri uri = Uri.file(filePath); + + if (!File(uri.toFilePath()).existsSync() || !await canLaunchUrl(uri)) { + throw "$uri does not exist, or there's no handler registered for it!"; + } + if (!await launchUrl(uri)) { + throw 'Could not launch $uri'; + } +// #enddocregion file +} diff --git a/packages/url_launcher/url_launcher/example/pubspec.yaml b/packages/url_launcher/url_launcher/example/pubspec.yaml index f459dc5bdbdc..9f60e33bfb50 100644 --- a/packages/url_launcher/url_launcher/example/pubspec.yaml +++ b/packages/url_launcher/url_launcher/example/pubspec.yaml @@ -9,6 +9,7 @@ environment: dependencies: flutter: sdk: flutter + path: ^1.8.2 url_launcher: # When depending on this package from a real application you should use: # url_launcher: ^x.y.z From 8938f7049b709a791c4df98ddda4d0e2b72b4573 Mon Sep 17 00:00:00 2001 From: David Iglesias Teixeira Date: Fri, 8 Jul 2022 13:10:12 -0700 Subject: [PATCH 05/10] Update README with extracted excerpts. --- packages/url_launcher/url_launcher/README.md | 65 ++++++++++++++------ 1 file changed, 47 insertions(+), 18 deletions(-) diff --git a/packages/url_launcher/url_launcher/README.md b/packages/url_launcher/url_launcher/README.md index 5f78fa7b9bf6..0bb78e387294 100644 --- a/packages/url_launcher/url_launcher/README.md +++ b/packages/url_launcher/url_launcher/README.md @@ -1,3 +1,5 @@ + + # url_launcher [![pub package](https://img.shields.io/pub/v/url_launcher.svg)](https://pub.dev/packages/url_launcher) @@ -14,6 +16,7 @@ To use this plugin, add `url_launcher` as a [dependency in your pubspec.yaml fil ### Example + ``` dart import 'package:flutter/material.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -33,8 +36,10 @@ void main() => runApp( ), ); -void _launchUrl() async { - if (!await launchUrl(_url)) throw 'Could not launch $_url'; +Future _launchUrl() async { + if (!await launchUrl(_url)) { + throw 'Could not launch $_url'; + } } ``` @@ -65,18 +70,25 @@ on Android 11 (API 30) or higher. A `` element must be added to your manifest as a child of the root element. Example: + + ``` xml + - - + + + + + + ``` @@ -133,22 +145,36 @@ due to [a bug](https://github.com/dart-lang/sdk/issues/43838) in the way `Uri` encodes query parameters. Using `queryParameters` will result in spaces being converted to `+` in many cases. + ```dart String? encodeQueryParameters(Map params) { return params.entries - .map((e) => '${Uri.encodeComponent(e.key)}=${Uri.encodeComponent(e.value)}') + .map((MapEntry e) => '${Uri.encodeComponent(e.key)}=${Uri.encodeComponent(e.value)}') .join('&'); } +// ··· + final Uri emailLaunchUri = Uri( + scheme: 'mailto', + path: 'smith@example.com', + query: encodeQueryParameters({ + 'subject': 'Example Subject & Symbols are allowed!' + }), + ); + + launchUrl(emailLaunchUri); +``` -final Uri emailLaunchUri = Uri( - scheme: 'mailto', - path: 'smith@example.com', - query: encodeQueryParameters({ - 'subject': 'Example Subject & Symbols are allowed!' - }), -); +Encoding for `sms` is slightly different: -launchUrl(emailLaunchUri); + +```dart +final Uri smsLaunchUri = Uri( + scheme: 'sms', + path: '0118 999 881 999 119 7253', + queryParameters: { + 'body': Uri.encodeComponent('Example Subject & Symbols are allowed!'), + }, +); ``` ### URLs not handled by `Uri` @@ -168,14 +194,17 @@ original APIs. We recommend checking first whether the directory or file exists before calling `launchUrl`. Example: + + ```dart -var filePath = '/path/to/file'; +final String filePath = testFile.absolute.path; final Uri uri = Uri.file(filePath); -if (await File(uri.toFilePath()).exists()) { - if (!await launchUrl(uri)) { - throw 'Could not launch $uri'; - } +if (!File(uri.toFilePath()).existsSync() || !await canLaunchUrl(uri)) { + throw "$uri does not exist, or there's no handler registered for it!"; +} +if (!await launchUrl(uri)) { + throw 'Could not launch $uri'; } ``` From 0773c55a9f9d95b06fed099986b82d545bd208ed Mon Sep 17 00:00:00 2001 From: David Iglesias Teixeira Date: Fri, 8 Jul 2022 13:11:23 -0700 Subject: [PATCH 06/10] Enable excerpt analysis in CI --- script/configs/temp_exclude_excerpt.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/script/configs/temp_exclude_excerpt.yaml b/script/configs/temp_exclude_excerpt.yaml index dec99ee6edd9..9f14bf2315aa 100644 --- a/script/configs/temp_exclude_excerpt.yaml +++ b/script/configs/temp_exclude_excerpt.yaml @@ -18,7 +18,6 @@ - plugin_platform_interface - quick_actions/quick_actions - shared_preferences/shared_preferences -- url_launcher/url_launcher - video_player/video_player - webview_flutter/webview_flutter - webview_flutter_android From 8a5704cdbaecaf77c0eecbadd4396e45f713a8c2 Mon Sep 17 00:00:00 2001 From: David Iglesias Teixeira Date: Fri, 8 Jul 2022 13:11:56 -0700 Subject: [PATCH 07/10] Update plugin registrants --- .../example/linux/flutter/generated_plugins.cmake | 8 ++++++++ .../example/windows/flutter/generated_plugins.cmake | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/packages/url_launcher/url_launcher/example/linux/flutter/generated_plugins.cmake b/packages/url_launcher/url_launcher/example/linux/flutter/generated_plugins.cmake index 1fc8ed344297..f16b4c34213a 100644 --- a/packages/url_launcher/url_launcher/example/linux/flutter/generated_plugins.cmake +++ b/packages/url_launcher/url_launcher/example/linux/flutter/generated_plugins.cmake @@ -6,6 +6,9 @@ list(APPEND FLUTTER_PLUGIN_LIST url_launcher_linux ) +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + set(PLUGIN_BUNDLED_LIBRARIES) foreach(plugin ${FLUTTER_PLUGIN_LIST}) @@ -14,3 +17,8 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST}) list(APPEND PLUGIN_BUNDLED_LIBRARIES $) list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/packages/url_launcher/url_launcher/example/windows/flutter/generated_plugins.cmake b/packages/url_launcher/url_launcher/example/windows/flutter/generated_plugins.cmake index 411af46dd721..88b22e5c775e 100644 --- a/packages/url_launcher/url_launcher/example/windows/flutter/generated_plugins.cmake +++ b/packages/url_launcher/url_launcher/example/windows/flutter/generated_plugins.cmake @@ -6,6 +6,9 @@ list(APPEND FLUTTER_PLUGIN_LIST url_launcher_windows ) +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + set(PLUGIN_BUNDLED_LIBRARIES) foreach(plugin ${FLUTTER_PLUGIN_LIST}) @@ -14,3 +17,8 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST}) list(APPEND PLUGIN_BUNDLED_LIBRARIES $) list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) From d8aaa1dcb30e4c96ba59806b251098342af3321e Mon Sep 17 00:00:00 2001 From: David Iglesias Teixeira Date: Fri, 8 Jul 2022 13:22:36 -0700 Subject: [PATCH 08/10] dart format + update excerpts --- packages/url_launcher/url_launcher/README.md | 5 +++-- packages/url_launcher/url_launcher/example/lib/encoding.dart | 5 +++-- packages/url_launcher/url_launcher/example/lib/files.dart | 5 ++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/url_launcher/url_launcher/README.md b/packages/url_launcher/url_launcher/README.md index 0bb78e387294..ebd757591aa7 100644 --- a/packages/url_launcher/url_launcher/README.md +++ b/packages/url_launcher/url_launcher/README.md @@ -149,7 +149,8 @@ converted to `+` in many cases. ```dart String? encodeQueryParameters(Map params) { return params.entries - .map((MapEntry e) => '${Uri.encodeComponent(e.key)}=${Uri.encodeComponent(e.value)}') + .map((MapEntry e) => + '${Uri.encodeComponent(e.key)}=${Uri.encodeComponent(e.value)}') .join('&'); } // ··· @@ -157,7 +158,7 @@ String? encodeQueryParameters(Map params) { scheme: 'mailto', path: 'smith@example.com', query: encodeQueryParameters({ - 'subject': 'Example Subject & Symbols are allowed!' + 'subject': 'Example Subject & Symbols are allowed!', }), ); diff --git a/packages/url_launcher/url_launcher/example/lib/encoding.dart b/packages/url_launcher/url_launcher/example/lib/encoding.dart index 251f24f23ac0..24c724466a77 100644 --- a/packages/url_launcher/url_launcher/example/lib/encoding.dart +++ b/packages/url_launcher/url_launcher/example/lib/encoding.dart @@ -15,7 +15,8 @@ import 'package:url_launcher/url_launcher.dart'; // #docregion encode-query-parameters String? encodeQueryParameters(Map params) { return params.entries - .map((MapEntry e) => '${Uri.encodeComponent(e.key)}=${Uri.encodeComponent(e.value)}') + .map((MapEntry e) => + '${Uri.encodeComponent(e.key)}=${Uri.encodeComponent(e.value)}') .join('&'); } // #enddocregion encode-query-parameters @@ -46,7 +47,7 @@ void _composeMail() { scheme: 'mailto', path: 'smith@example.com', query: encodeQueryParameters({ - 'subject': 'Example Subject & Symbols are allowed!' + 'subject': 'Example Subject & Symbols are allowed!', }), ); diff --git a/packages/url_launcher/url_launcher/example/lib/files.dart b/packages/url_launcher/url_launcher/example/lib/files.dart index 44689dd5d281..70a8d12ae973 100644 --- a/packages/url_launcher/url_launcher/example/lib/files.dart +++ b/packages/url_launcher/url_launcher/example/lib/files.dart @@ -27,7 +27,10 @@ void main() => runApp( Future _openFile() async { // Prepare a file within tmp - final String tempFilePath = p.joinAll([...p.split(Directory.systemTemp.path), 'flutter_url_launcher_example.txt']); + final String tempFilePath = p.joinAll([ + ...p.split(Directory.systemTemp.path), + 'flutter_url_launcher_example.txt' + ]); final File testFile = File(tempFilePath); await testFile.writeAsString('Hello, world!'); // #docregion file From 2bf3dc6d6b8719a4747e5f35e259c51a59c840bd Mon Sep 17 00:00:00 2001 From: David Iglesias Teixeira Date: Mon, 11 Jul 2022 17:01:51 -0700 Subject: [PATCH 09/10] Address PR comments and issues. --- packages/url_launcher/url_launcher/README.md | 14 +++++--------- .../android/app/src/main/AndroidManifest.xml | 10 +++++++--- .../url_launcher/example/lib/files.dart | 4 ++-- .../url_launcher/url_launcher/example/pubspec.yaml | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/packages/url_launcher/url_launcher/README.md b/packages/url_launcher/url_launcher/README.md index ebd757591aa7..e9e4dae476cc 100644 --- a/packages/url_launcher/url_launcher/README.md +++ b/packages/url_launcher/url_launcher/README.md @@ -71,24 +71,20 @@ element must be added to your manifest as a child of the root element. Example: - + ``` xml + - + - - - - - ``` @@ -201,8 +197,8 @@ Example: final String filePath = testFile.absolute.path; final Uri uri = Uri.file(filePath); -if (!File(uri.toFilePath()).existsSync() || !await canLaunchUrl(uri)) { - throw "$uri does not exist, or there's no handler registered for it!"; +if (!File(uri.toFilePath()).existsSync()) { + throw '$uri does not exist!'; } if (!await launchUrl(uri)) { throw 'Could not launch $uri'; diff --git a/packages/url_launcher/url_launcher/example/android/app/src/main/AndroidManifest.xml b/packages/url_launcher/url_launcher/example/android/app/src/main/AndroidManifest.xml index da5ddfdc1561..fe01f2fba9a8 100644 --- a/packages/url_launcher/url_launcher/example/android/app/src/main/AndroidManifest.xml +++ b/packages/url_launcher/url_launcher/example/android/app/src/main/AndroidManifest.xml @@ -10,20 +10,24 @@ + - + - + + - + + diff --git a/packages/url_launcher/url_launcher/example/lib/files.dart b/packages/url_launcher/url_launcher/example/lib/files.dart index 70a8d12ae973..d48440670406 100644 --- a/packages/url_launcher/url_launcher/example/lib/files.dart +++ b/packages/url_launcher/url_launcher/example/lib/files.dart @@ -37,8 +37,8 @@ Future _openFile() async { final String filePath = testFile.absolute.path; final Uri uri = Uri.file(filePath); - if (!File(uri.toFilePath()).existsSync() || !await canLaunchUrl(uri)) { - throw "$uri does not exist, or there's no handler registered for it!"; + if (!File(uri.toFilePath()).existsSync()) { + throw '$uri does not exist!'; } if (!await launchUrl(uri)) { throw 'Could not launch $uri'; diff --git a/packages/url_launcher/url_launcher/example/pubspec.yaml b/packages/url_launcher/url_launcher/example/pubspec.yaml index 9f60e33bfb50..72da3a659013 100644 --- a/packages/url_launcher/url_launcher/example/pubspec.yaml +++ b/packages/url_launcher/url_launcher/example/pubspec.yaml @@ -9,7 +9,7 @@ environment: dependencies: flutter: sdk: flutter - path: ^1.8.2 + path: ^1.8.1 url_launcher: # When depending on this package from a real application you should use: # url_launcher: ^x.y.z From 9212fed67267d512ff39e9be540e49ea90e9c4f3 Mon Sep 17 00:00:00 2001 From: David Iglesias Teixeira Date: Tue, 12 Jul 2022 17:39:49 -0700 Subject: [PATCH 10/10] Update path dep to ^1.8.0 --- packages/url_launcher/url_launcher/example/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/url_launcher/url_launcher/example/pubspec.yaml b/packages/url_launcher/url_launcher/example/pubspec.yaml index 72da3a659013..673785e9e1f6 100644 --- a/packages/url_launcher/url_launcher/example/pubspec.yaml +++ b/packages/url_launcher/url_launcher/example/pubspec.yaml @@ -9,7 +9,7 @@ environment: dependencies: flutter: sdk: flutter - path: ^1.8.1 + path: ^1.8.0 url_launcher: # When depending on this package from a real application you should use: # url_launcher: ^x.y.z