Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 9bc9a59

Browse files
authored
Add documentation (#9)
1 parent 66892d1 commit 9bc9a59

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

packages/url-launcher/lib/url_launcher.dart

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,25 @@ import 'package:flutter/services.dart';
88

99
const _channel = const MethodChannel('plugins.flutter.io/url_launcher');
1010

11-
/// Parse the specified URL string and delegate handling of the same to the
11+
/// Parses the specified URL string and delegates handling of it to the
1212
/// underlying platform.
13+
///
14+
/// The returned future completes with a [PlatformException] on invalid URLs and
15+
/// schemes which cannot be handled, that is when [canLaunch] would complete
16+
/// with false.
1317
Future<Null> launch(String urlString) {
1418
return _channel.invokeMethod(
1519
'launch',
1620
urlString,
1721
);
1822
}
1923

20-
Future<bool> canLaunch(String urlString) {
21-
return _channel.invokeMethod(
24+
/// Checks whether the specified URL can be handled by some app installed on the
25+
/// device.
26+
Future<bool> canLaunch(String urlString) async {
27+
if (urlString == null)
28+
return false;
29+
return await _channel.invokeMethod(
2230
'canLaunch',
2331
urlString,
2432
);

0 commit comments

Comments
 (0)