isAppInstalled method

Future<bool> isAppInstalled(
  1. String packageName
)

Check if app is installed (checks both release and debug variants)

Implementation

Future<bool> isAppInstalled(String packageName) async {
  if (!Platform.isAndroid) return false;

  try {
    // Check release package
    var result = await _channel.invokeMethod<bool>('isAppInstalled', {
      'packageName': packageName,
    });
    if (result == true) return true;

    // Check debug package
    result = await _channel.invokeMethod<bool>('isAppInstalled', {
      'packageName': '$packageName.debug',
    });
    return result ?? false;
  } catch (e) {
    debugPrint('❌ isAppInstalled error: $e');
    return false;
  }
}