getInstalledApps static method
Future<List<AppInfo> >
getInstalledApps({
- bool excludeSystemApps = true,
- bool excludeNonLaunchableApps = true,
- bool withIcon = false,
- String? packageNamePrefix,
- PlatformType? platformType,
Retrieves a list of installed apps on the device.
excludeSystemApps — whether to exclude system apps from the list. Default is true.
excludeNonLaunchableApps — whether to exclude apps that cannot be launched (no launch intent). Default is true.
withIcon — whether to include app icons in the list. Default is false.
packageNamePrefix — optional prefix to filter apps whose package names start with this value. Default is null.
platformType — optional parameter to specify the app platform type. Default is null.
Returns a list of AppInfo objects representing the installed apps.
Implementation
static Future<List<AppInfo>> getInstalledApps({
bool excludeSystemApps = true,
bool excludeNonLaunchableApps = true,
bool withIcon = false,
String? packageNamePrefix,
PlatformType? platformType,
}) async {
try {
dynamic apps = await _channel.invokeMethod(
"getInstalledApps",
{
"exclude_system_apps": excludeSystemApps,
"exclude_non_launchable_apps": excludeNonLaunchableApps,
"with_icon": withIcon,
"package_name_prefix": packageNamePrefix,
"platform_type": platformType?.slug,
},
);
return AppInfo.parseList(apps);
} catch (e) {
debugPrint("Error fetching installed apps: $e");
return [];
}
}