getInstalledUpiApps method

  1. @override
Future<List<UpiApp>> getInstalledUpiApps()
override

Retrieves list of installed UPI-capable payment apps.

Implementation

@override
Future<List<UpiApp>> getInstalledUpiApps() async {
  try {
    final List<dynamic>? apps = await methodChannel.invokeListMethod<dynamic>('getInstalledUpiApps');
    if (apps == null) return [];
    return apps
        .whereType<Map<dynamic, dynamic>>()
        .map((map) => UpiApp.fromMap(map))
        .toList();
  } on PlatformException catch (e) {
    throw UpiException(
      code: _mapErrorCode(e.code),
      message: e.message ?? 'Failed to get installed UPI apps.',
      details: e.details,
    );
  }
}