-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work lista: null-safetySupport for Dart's null safety featureSupport for Dart's null safety featurec: crashStack traces logged to the consoleStack traces logged to the consolefound in release: 1.25Found to occur in 1.25Found to occur in 1.25has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: url_launcherPlugin to launch external applicationsPlugin to launch external applicationspackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-iosiOS applications specificallyiOS applications specifically
Milestone
Description
Steps to Reproduce
- Run
flutter create bug. - Update the files as follows: https://pub.dev/packages/url_launcher#encoding-urls
- Flutter run
Expected results:
Mailto works like in the example
Actual results:
PlatformException(
code: 'NOT_A_WEB_SCHEME',
message: 'To use webview or safariVC, you need to pass'
'in a web URL. This $urlString is not a web URL.')
Responsible code:
String urlString, {
bool forceSafariVC,
bool forceWebView,
bool enableJavaScript,
bool enableDomStorage,
bool universalLinksOnly,
Map<String, String> headers,
Brightness statusBarBrightness,
String webOnlyWindowName,
}) async {
assert(urlString != null);
final Uri url = Uri.parse(urlString.trimLeft());
final bool isWebURL = url.scheme == 'http' || url.scheme == 'https';
if ((forceSafariVC == true || forceWebView == true) && !isWebURL) {
throw PlatformException(
code: 'NOT_A_WEB_SCHEME',
message: 'To use webview or safariVC, you need to pass'
'in a web URL. This $urlString is not a web URL.');
}
was changed to:
String urlString, {
bool forceSafariVC = true,
bool forceWebView = false,
bool enableJavaScript = false,
bool enableDomStorage = false,
bool universalLinksOnly = false,
Map<String, String> headers = const <String, String>{},
Brightness? statusBarBrightness,
String? webOnlyWindowName,
}) async {
final Uri url = Uri.parse(urlString.trimLeft());
final bool isWebURL = url.scheme == 'http' || url.scheme == 'https';
if ((forceSafariVC == true || forceWebView == true) && !isWebURL) {
throw PlatformException(
code: 'NOT_A_WEB_SCHEME',
message: 'To use webview or safariVC, you need to pass'
'in a web URL. This $urlString is not a web URL.');
}
...so, since now forceSafariVC has become true by default, the assertion
((forceSafariVC == true || forceWebView == true) && !isWebURL)
is also true by default for all schemes except url.scheme == 'http' || url.scheme == 'https' (isWebURL),
resulting in the example throwing the above exception.
To send a mail without this exception, you now explicitly have to pass forceSafariVC = false (which is not expected).
If I can help, I would like to open a pull request for fixing the issue.
Logs
[✓] Flutter (Channel beta, 1.24.0-10.2.pre, on macOS 11.0.1 20B29 darwin-x64,
locale en-US)
• Flutter version 1.24.0-10.2.pre at /Users/achim/flutter
• Framework revision 022b333a08 (2 weeks ago), 2020-11-18 11:35:09 -0800
• Engine revision 07c1eed46b
• Dart version 2.12.0 (build 2.12.0-29.10.beta)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at /Users/achim/Library/Android/sdk
• Platform android-30, build-tools 30.0.2
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_242-release-1644-b3-6915495)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 12.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.2, Build version 12B45b
• CocoaPods version 1.10.0
[✓] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build
1.8.0_242-release-1644-b3-6915495)
[✓] VS Code (version 1.51.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.16.0
Metadata
Metadata
Assignees
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work lista: null-safetySupport for Dart's null safety featureSupport for Dart's null safety featurec: crashStack traces logged to the consoleStack traces logged to the consolefound in release: 1.25Found to occur in 1.25Found to occur in 1.25has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: url_launcherPlugin to launch external applicationsPlugin to launch external applicationspackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-iosiOS applications specificallyiOS applications specifically