launch method

  1. @override
Future<bool> launch(
  1. String url, {
  2. required bool useSafariVC,
  3. required bool useWebView,
  4. required bool enableJavaScript,
  5. required bool enableDomStorage,
  6. required bool universalLinksOnly,
  7. required Map<String, String> headers,
  8. String? webOnlyWindowName,
})

Passes url to the underlying platform for handling.

Returns true if the given url was successfully launched.

For documentation on the other arguments, see the launch documentation in package:url_launcher/url_launcher.dart.

Implementation

@override
Future<bool> launch(
  String url, {
  required bool useSafariVC,
  required bool useWebView,
  required bool enableJavaScript,
  required bool enableDomStorage,
  required bool universalLinksOnly,
  required Map<String, String> headers,
  String? webOnlyWindowName,
}) async {
  final PreferredLaunchMode mode;
  if (useSafariVC) {
    mode = PreferredLaunchMode.inAppBrowserView;
  } else if (universalLinksOnly) {
    mode = PreferredLaunchMode.externalNonBrowserApplication;
  } else {
    mode = PreferredLaunchMode.externalApplication;
  }
  return launchUrl(
      url,
      LaunchOptions(
          mode: mode,
          webViewConfiguration: InAppWebViewConfiguration(
              enableDomStorage: enableDomStorage,
              enableJavaScript: enableJavaScript,
              headers: headers)));
}