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

Commit

Permalink
Add documentation (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
szakarias authored May 1, 2017
1 parent 66892d1 commit 9bc9a59
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions packages/url-launcher/lib/url_launcher.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,25 @@ import 'package:flutter/services.dart';

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

/// Parse the specified URL string and delegate handling of the same to the
/// Parses the specified URL string and delegates handling of it to the
/// underlying platform.
///
/// The returned future completes with a [PlatformException] on invalid URLs and
/// schemes which cannot be handled, that is when [canLaunch] would complete
/// with false.
Future<Null> launch(String urlString) {
return _channel.invokeMethod(
'launch',
urlString,
);
}

Future<bool> canLaunch(String urlString) {
return _channel.invokeMethod(
/// Checks whether the specified URL can be handled by some app installed on the
/// device.
Future<bool> canLaunch(String urlString) async {
if (urlString == null)
return false;
return await _channel.invokeMethod(
'canLaunch',
urlString,
);
Expand Down

0 comments on commit 9bc9a59

Please sign in to comment.