revoke method

Future<void> revoke(
  1. String packageName,
  2. String permission, {
  3. String? user,
  4. bool debug = false,
})

revoke the specified permission from the package with the given packageName.

If user is provided, the permission is revoked from the specified user.

Throws an exception if the package manager command fails.

Example:

await pm.revoke('com.example.app', 'android.permission.CAMERA');

Implementation

Future<void> revoke(String packageName, String permission, {String? user, bool debug = false}) async {
  final args = ['pm', 'revoke'];

  if (user != null) {
    args.addAll(['--user', user]);
  }

  args.addAll([packageName, permission]);
  await _shell.exec(args, debug: debug);
}