getInstalledApps method

  1. @override
Future<List<AppInfo>> getInstalledApps()
override

Fetches a list of all installed apps.

This method sends a method call to the native platform to fetch the list of apps. If the method call fails, an empty list is returned.

Implementation

@override
Future<List<AppInfo>> getInstalledApps() async {
  try {
    List<Object?> apps = await methodChannel.invokeMethod('getInstalledApps');
    List<AppInfo> appInfoList =
        apps.map((app) => AppInfo.create(app)).toList();
    return Future.value(appInfoList);
  } on PlatformException {
    debugPrint("APPS ERROR");
    return Future.value([]);
  }
}