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

Add doc to canLaunch #9

Merged
merged 3 commits into from
May 1, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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