getInstalledApps method

Future<List<App>> getInstalledApps({
  1. bool includeSystemApps = false,
  2. bool onlyIncludeAppsWithLaunchIntent = true,
  3. bool includeAppIcon = false,
})

This method gets a list of all installed apps including appName, packageName, versionName, decodedIcon, installDate and lastUpdateDate.

To view app icon set includeAppIcon to true and use Image.network(decodedIcon).

Implementation

Future<List<App>> getInstalledApps({
  bool includeSystemApps = false,
  bool onlyIncludeAppsWithLaunchIntent = true,
  bool includeAppIcon = false,
}) async {
  try {
    List appsInfo = await (_channel.invokeMethod("getInstalledApps", {
      "includeSystemApps": includeSystemApps,
      "onlyIncludeAppsWithLaunchIntent": onlyIncludeAppsWithLaunchIntent,
      "includeAppIcon": includeAppIcon,
    }));
    List<App> apps = [];
    for (Map appInfo in appsInfo) {
      apps.add(App.fromMap(appInfo));
    }
    return apps;
  } on PlatformException catch (e) {
    throwError(e, "getting installed apps");
    return [];
  }
}