launchUrl function

Future<bool> launchUrl(
  1. Uri url, {
  2. LaunchMode mode = LaunchMode.platformDefault,
  3. WebViewConfiguration webViewConfiguration = const WebViewConfiguration(),
  4. String? webOnlyWindowName,
})

Implementation

Future<bool> launchUrl(
    Uri url, {
      LaunchMode mode = LaunchMode.platformDefault,
      WebViewConfiguration webViewConfiguration = const WebViewConfiguration(),
      String? webOnlyWindowName,
    }) async {
  if (mode == LaunchMode.inAppWebView &&
      !(url.scheme == 'https' || url.scheme == 'http')) {
    throw ArgumentError.value(url, 'url',
        'To use an in-app web view, you must provide an http(s) URL.');
  }
  return UrlLauncherPlatform.instance.launchUrl(
    url.toString(),
    LaunchOptions(
      mode: convertLaunchMode(mode),
      webViewConfiguration: convertConfiguration(webViewConfiguration),
      webOnlyWindowName: webOnlyWindowName,
    ),
  );
}