Skip to content

Commit 298fb23

Browse files
author
Francesco Iapicca
authored
[documentation] [url_launcher] fix for readme code sample (flutter#3308)
* code sample fixed * updated CHANGELOG.md and pubspec.yaml
1 parent 7d39247 commit 298fb23

File tree

3 files changed

+20
-19
lines changed

3 files changed

+20
-19
lines changed

packages/url_launcher/url_launcher/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 5.7.12
2+
3+
* Updated code sample in `README.md`
4+
15
## 5.7.11
26

37
* Update integration test examples to use `testWidgets` instead of `test`.

packages/url_launcher/url_launcher/README.md

+15-18
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,23 @@ To use this plugin, add `url_launcher` as a [dependency in your pubspec.yaml fil
1414
import 'package:flutter/material.dart';
1515
import 'package:url_launcher/url_launcher.dart';
1616
17-
void main() {
18-
runApp(Scaffold(
19-
body: Center(
20-
child: RaisedButton(
21-
onPressed: _launchURL,
22-
child: Text('Show Flutter homepage'),
17+
const _url = 'https://flutter.dev';
18+
19+
void main() => runApp(
20+
const MaterialApp(
21+
home: Material(
22+
child: Center(
23+
child: RaisedButton(
24+
onPressed: _launchURL,
25+
child: Text('Show Flutter homepage'),
26+
),
27+
),
28+
),
2329
),
24-
),
25-
));
26-
}
27-
28-
_launchURL() async {
29-
const url = 'https://flutter.dev';
30-
if (await canLaunch(url)) {
31-
await launch(url);
32-
} else {
33-
throw 'Could not launch $url';
34-
}
35-
}
30+
);
3631
32+
void _launchURL() async =>
33+
await canLaunch(_url) ? await launch(_url) : throw 'Could not launch $_url';
3734
```
3835

3936
## Supported URL schemes

packages/url_launcher/url_launcher/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: url_launcher
22
description: Flutter plugin for launching a URL on Android and iOS. Supports
33
web, phone, SMS, and email schemes.
44
homepage: https://github.com/flutter/plugins/tree/master/packages/url_launcher/url_launcher
5-
version: 5.7.11
5+
version: 5.7.12
66

77
flutter:
88
plugin:

0 commit comments

Comments
 (0)