diff --git a/packages/url_launcher/url_launcher/CHANGELOG.md b/packages/url_launcher/url_launcher/CHANGELOG.md index 2855eade4d21..6b1327a2da52 100644 --- a/packages/url_launcher/url_launcher/CHANGELOG.md +++ b/packages/url_launcher/url_launcher/CHANGELOG.md @@ -1,3 +1,7 @@ +## 5.4.11 + +* Add documentation in README suggesting how to properly encode urls with special characters. + ## 5.4.10 * Post-v2 Android embedding cleanups. @@ -68,7 +72,7 @@ ## 5.2.3 -Android: Use android.arch.lifecycle instead of androidx.lifecycle:lifecycle in `build.gradle` to support apps that has not been migrated to AndroidX. +* Android: Use android.arch.lifecycle instead of androidx.lifecycle:lifecycle in `build.gradle` to support apps that has not been migrated to AndroidX. ## 5.2.2 diff --git a/packages/url_launcher/url_launcher/README.md b/packages/url_launcher/url_launcher/README.md index 2dcc6359c1af..53c7fe96cde7 100644 --- a/packages/url_launcher/url_launcher/README.md +++ b/packages/url_launcher/url_launcher/README.md @@ -53,6 +53,27 @@ Common schemes supported by both iOS and Android: More details can be found here for [iOS](https://developer.apple.com/library/content/featuredarticles/iPhoneURLScheme_Reference/Introduction/Introduction.html) and [Android](https://developer.android.com/guide/components/intents-common.html) +### Encoding URLs + +URLs must be properly encoded, especially when including spaces or other special characters. This can be done using the [`Uri` class](https://api.dart.dev/stable/2.7.1/dart-core/Uri-class.html): +```dart +import 'dart:core'; +import 'package:url_launcher/url_launcher.dart'; + +final Uri _emailLaunchUri = Uri( + scheme: 'mailto', + path: 'smith@example.com', + queryParameters: { + 'subject': 'Example Subject & Symbols are allowed!' + } +); + +// ... + +// mailto:smith@example.com?subject=Example+Subject+%26+Symbols+are+allowed%21 +launch(_emailLaunchUri.toString()); +``` + ## Handling missing URL receivers A particular mobile device may not be able to receive all supported URL schemes. diff --git a/packages/url_launcher/url_launcher/pubspec.yaml b/packages/url_launcher/url_launcher/pubspec.yaml index 156d608583a5..08ac3f9f8b80 100644 --- a/packages/url_launcher/url_launcher/pubspec.yaml +++ b/packages/url_launcher/url_launcher/pubspec.yaml @@ -2,7 +2,7 @@ name: url_launcher description: Flutter plugin for launching a URL on Android and iOS. Supports web, phone, SMS, and email schemes. homepage: https://github.com/flutter/plugins/tree/master/packages/url_launcher/url_launcher -version: 5.4.10 +version: 5.4.11 flutter: plugin: