launchUrl method

Future<bool> launchUrl(
  1. String url,
  2. LaunchOptions options
)

Passes url to the underlying platform for handling.

Returns true if the given url was successfully launched.

Implementation

Future<bool> launchUrl(String url, LaunchOptions options) {
  final bool isWebURL = url.startsWith('http:') || url.startsWith('https:');
  final bool useWebView = options.mode == PreferredLaunchMode.inAppWebView ||
      options.mode == PreferredLaunchMode.inAppBrowserView ||
      (isWebURL && options.mode == PreferredLaunchMode.platformDefault);

  return launch(
    url,
    useSafariVC: useWebView,
    useWebView: useWebView,
    enableJavaScript: options.webViewConfiguration.enableJavaScript,
    enableDomStorage: options.webViewConfiguration.enableDomStorage,
    universalLinksOnly:
        options.mode == PreferredLaunchMode.externalNonBrowserApplication,
    headers: options.webViewConfiguration.headers,
    webOnlyWindowName: options.webOnlyWindowName,
  );
}