@@ -21,6 +21,12 @@ class AppInfo {
2121 this .isSystem,
2222 this .iconBytes,
2323 this .category,
24+ this .targetSdkVersion,
25+ this .minSdkVersion,
26+ this .enabled,
27+ this .processName,
28+ this .installLocation,
29+ this .requestedPermissions,
2430 });
2531
2632 /// Creates an [AppInfo] from a map of key-value pairs.
@@ -39,6 +45,17 @@ class AppInfo {
3945 lastUpdateTime != null ? DateTime .fromMillisecondsSinceEpoch (lastUpdateTime) : null ;
4046
4147 final int ? category = m['category' ] != null ? int .tryParse (m['category' ]! .toString ()) : null ;
48+ final int ? targetSdkVersion =
49+ m['targetSdkVersion' ] != null ? int .tryParse (m['targetSdkVersion' ]! .toString ()) : null ;
50+ final int ? minSdkVersion =
51+ m['minSdkVersion' ] != null ? int .tryParse (m['minSdkVersion' ]! .toString ()) : null ;
52+ final bool ? enabled = m['enabled' ] != null ? bool .tryParse (m['enabled' ]! .toString ()) : null ;
53+ final int ? installLocation =
54+ m['installLocation' ] != null ? int .tryParse (m['installLocation' ]! .toString ()) : null ;
55+ final List <String >? requestedPermissions = m['requestedPermissions' ] is List <dynamic >
56+ ? (m['requestedPermissions' ]! as List <dynamic >).map ((e) => e.toString ()).toList ()
57+ : null ;
58+
4259 return AppInfo (
4360 packageName: m['packageName' ]? .toString (),
4461 appName: m['appName' ]? .toString (),
@@ -50,6 +67,12 @@ class AppInfo {
5067 iconBytes:
5168 m['iconBytes' ] is List <int > ? Uint8List .fromList (m['iconBytes' ]! as List <int >) : null ,
5269 category: category,
70+ targetSdkVersion: targetSdkVersion,
71+ minSdkVersion: minSdkVersion,
72+ enabled: enabled,
73+ processName: m['processName' ]? .toString (),
74+ installLocation: installLocation,
75+ requestedPermissions: requestedPermissions,
5376 );
5477 }
5578
@@ -80,6 +103,24 @@ class AppInfo {
80103 /// App category (Android [ApplicationInfo.category] , API 26+). Raw int from platform. Null when not set or API < 26.
81104 final int ? category;
82105
106+ /// Target SDK version (Android [ApplicationInfo.targetSdkVersion] ).
107+ final int ? targetSdkVersion;
108+
109+ /// Min SDK version (Android [ApplicationInfo.minSdkVersion] ).
110+ final int ? minSdkVersion;
111+
112+ /// Whether the app is enabled (Android [ApplicationInfo.enabled] ).
113+ final bool ? enabled;
114+
115+ /// Process name (Android [ApplicationInfo.processName] ).
116+ final String ? processName;
117+
118+ /// Install location (Android [PackageInfo.installLocation] ).
119+ final int ? installLocation;
120+
121+ /// Requested permissions (Android [PackageInfo.requestedPermissions] ).
122+ final List <String >? requestedPermissions;
123+
83124 /// Converts this [AppInfo] to a map representation.
84125 ///
85126 /// Useful for serialization to platform channels or other data formats.
@@ -93,6 +134,12 @@ class AppInfo {
93134 'isSystem' : isSystem,
94135 'iconBytes' : iconBytes,
95136 'category' : category,
137+ 'targetSdkVersion' : targetSdkVersion,
138+ 'minSdkVersion' : minSdkVersion,
139+ 'enabled' : enabled,
140+ 'processName' : processName,
141+ 'installLocation' : installLocation,
142+ 'requestedPermissions' : requestedPermissions,
96143 };
97144}
98145
0 commit comments