canLaunchUrlString function

Future<bool> canLaunchUrlString(
  1. String urlString
)

String version of canLaunchUrl.

This should be used only in the very rare case of needing to check a URL that is considered valid by the host platform, but not by Dart's Uri class. In all other cases, use canLaunchUrl instead, as that will ensure that you are providing a valid URL.

The behavior of this method when passing an invalid URL is entirely platform-specific; no effort is made by the plugin to make the URL valid. Some platforms may provide best-effort interpretation of an invalid URL, others will immediately fail if the URL can't be parsed according to the official standards that define URL formats.

Implementation

Future<bool> canLaunchUrlString(String urlString) async {
  return UrlLauncherPlatform.instance.canLaunch(urlString);
}