@@ -26,7 +26,6 @@ class AppInfo {
2626 this .enabled,
2727 this .processName,
2828 this .installLocation,
29- this .requestedPermissions,
3029 });
3130
3231 /// Creates an [AppInfo] from a map of key-value pairs.
@@ -52,9 +51,6 @@ class AppInfo {
5251 final bool ? enabled = m['enabled' ] != null ? bool .tryParse (m['enabled' ]! .toString ()) : null ;
5352 final int ? installLocation =
5453 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 ;
5854
5955 return AppInfo (
6056 packageName: m['packageName' ]? .toString (),
@@ -72,7 +68,6 @@ class AppInfo {
7268 enabled: enabled,
7369 processName: m['processName' ]? .toString (),
7470 installLocation: installLocation,
75- requestedPermissions: requestedPermissions,
7671 );
7772 }
7873
@@ -100,47 +95,23 @@ class AppInfo {
10095 /// The app icon as raw bytes, if requested and available.
10196 final Uint8List ? iconBytes;
10297
103- /// App category (Android [ ApplicationInfo.category] , API 26+). Raw int from platform. Null when not set or API < 26.
98+ /// App category (Android ApplicationInfo.category, API 26+). Raw int from platform. Null when not set or API < 26.
10499 final int ? category;
105100
106- /// Target SDK version (Android [ ApplicationInfo.targetSdkVersion] ).
101+ /// Target SDK version (Android ApplicationInfo.targetSdkVersion).
107102 final int ? targetSdkVersion;
108103
109- /// Min SDK version (Android [ ApplicationInfo.minSdkVersion] ).
104+ /// Min SDK version (Android ApplicationInfo.minSdkVersion).
110105 final int ? minSdkVersion;
111106
112- /// Whether the app is enabled (Android [ ApplicationInfo.enabled] ).
107+ /// Whether the app is enabled (Android ApplicationInfo.enabled).
113108 final bool ? enabled;
114109
115- /// Process name (Android [ ApplicationInfo.processName] ).
110+ /// Process name (Android ApplicationInfo.processName).
116111 final String ? processName;
117112
118- /// Install location (Android [ PackageInfo.installLocation] ).
113+ /// Install location (Android PackageInfo.installLocation).
119114 final int ? installLocation;
120-
121- /// Requested permissions (Android [PackageInfo.requestedPermissions] ).
122- final List <String >? requestedPermissions;
123-
124- /// Converts this [AppInfo] to a map representation.
125- ///
126- /// Useful for serialization to platform channels or other data formats.
127- Map <String , Object ?> toMap () => {
128- 'packageName' : packageName,
129- 'appName' : appName,
130- 'versionName' : versionName,
131- 'versionCode' : versionCode,
132- 'firstInstallTime' : firstInstallTime? .millisecondsSinceEpoch,
133- 'lastUpdateTime' : lastUpdateTime? .millisecondsSinceEpoch,
134- 'isSystem' : isSystem,
135- 'iconBytes' : iconBytes,
136- 'category' : category,
137- 'targetSdkVersion' : targetSdkVersion,
138- 'minSdkVersion' : minSdkVersion,
139- 'enabled' : enabled,
140- 'processName' : processName,
141- 'installLocation' : installLocation,
142- 'requestedPermissions' : requestedPermissions,
143- };
144115}
145116
146117/// Base class every platform implementation must extend.
@@ -175,6 +146,12 @@ abstract class FlutterDeviceAppsPlatform extends PlatformInterface {
175146 /// Gets details for a single app.
176147 Future <AppInfo ?> getApp (String packageName, {bool includeIcon = false });
177148
149+ /// Gets the requested permissions for a specific app.
150+ ///
151+ /// Implementations should return the Android PackageInfo.requestedPermissions
152+ /// list for the given [packageName] , or null if not available.
153+ Future <List <String >?> getRequestedPermissions (String packageName);
154+
178155 /// Best-effort: launches an app by package name. Returns false if not launchable.
179156 Future <bool > openApp (String packageName);
180157
@@ -222,6 +199,10 @@ class _UnimplementedPlatform extends FlutterDeviceAppsPlatform {
222199 Future <AppInfo ?> getApp (String packageName, {bool includeIcon = false }) =>
223200 Future .error (UnsupportedError ('FlutterDeviceAppsPlatform not implemented' ));
224201
202+ @override
203+ Future <List <String >?> getRequestedPermissions (String packageName) =>
204+ Future .error (UnsupportedError ('FlutterDeviceAppsPlatform not implemented' ));
205+
225206 @override
226207 Future <bool > openApp (String packageName) =>
227208 Future .error (UnsupportedError ('FlutterDeviceAppsPlatform not implemented' ));
0 commit comments