isInstalled static method

Future<bool> isInstalled(
  1. String? uri
)

Detects if the given app (Represented by the URI) is installed. If on android/ios, this uses the AppCheck library. On web, this uses the injected values in the Javascript.

Implementation

static Future<bool> isInstalled(String? uri) async {
  if (uri == null || uri.isEmpty) {
    return false;
  }

  try {
    return getPlatformType() == PlatformType.mobile &&
        await canLaunchUrl(
          Uri.parse(
            uri,
          ),
        );
  } catch (_) {
    // print(e);
  }

  return false;
}