Skip to content

Commit 613860f

Browse files
authored
Fix: Update URL launch method to use Uri.parse (#12518)
Fixes #12410 **Before:** - Wasn't opening the website by clicking on the launch button. I don't have a screenshot of that as the app was not breaking but was just not opening the webpage. I could not find any error logs in the emulator logs. Only thing I can verify is that this issue persists on macOS and iPhone 14 emulator. **After:** Opened the website successfully <img width="382" alt="image" src="https://github.com/user-attachments/assets/455279e2-b1f5-4d5b-b50c-fef7b4521ab5" />
1 parent 1814e8b commit 613860f

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

examples/platform_integration/plugin_api_migration/lib/url_launcher.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// #docregion url-launcher
22
import 'package:flutter/material.dart';
3-
import 'package:path/path.dart' as p;
43
import 'package:url_launcher/url_launcher.dart';
54

65
void main() {
@@ -20,7 +19,7 @@ class DemoPage extends StatelessWidget {
2019
const DemoPage({super.key});
2120

2221
void launchURL() {
23-
launchUrl(p.toUri('https://flutter.dev'));
22+
launchUrl(Uri.parse('https://flutter.dev'));
2423
}
2524

2625
@override

src/content/packages-and-plugins/using-packages.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,6 @@ To use this plugin:
452452
<?code-excerpt "lib/url_launcher.dart (url-launcher)"?>
453453
```dart
454454
import 'package:flutter/material.dart';
455-
import 'package:path/path.dart' as p;
456455
import 'package:url_launcher/url_launcher.dart';
457456
458457
void main() {
@@ -472,7 +471,7 @@ To use this plugin:
472471
const DemoPage({super.key});
473472
474473
void launchURL() {
475-
launchUrl(p.toUri('https://flutter.dev'));
474+
launchUrl(Uri.parse('https://flutter.dev'));
476475
}
477476
478477
@override

0 commit comments

Comments
 (0)