launch static method

Future<bool> launch(
  1. String url
)

Opens url via the OS handler. Returns false on channel error or when no handler can resolve the scheme.

Scheme is gated against a fixed allowlist. Schemes like intent://, file://, javascript:, data:, or USSD-bearing tel:*…# are rejected before reaching the OS dispatcher — message text is sender-controlled and the OS will happily launch privileged or destructive URIs otherwise.

Implementation

static Future<bool> launch(String url) async {
  if (kIsWeb) return false;
  if (!(Platform.isIOS ||
      Platform.isAndroid ||
      Platform.isMacOS ||
      Platform.isWindows)) {
    return false;
  }
  if (!_isLaunchable(url)) return false;
  try {
    final ok = await _channel.invokeMethod<bool>('launch', {'url': url});
    return ok ?? false;
  } on PlatformException {
    return false;
  } on MissingPluginException {
    return false;
  }
}