2

I am using device_apps to list the available apps on my device. I want to uninstall an app by tapping on the Icon button, is there any way I can do the same?enter image description here

  • You can't do it inside your app.. Refer here: https://stackoverflow.com/questions/55163793/how-to-uninstall-an-app-in-flutter-programatically – AmitB10 Jun 02 '20 at 06:28

1 Answers1

1

Answer inspired from this question and by @Vicky Salunkhe

To uninstall an app pass the package name to it. $packageName is a variable ex, some.app.id

android_intent.Intent()
  ..setAction(android_action.Action.ACTION_DELETE)
  ..setData(Uri.parse("package:$packageName"))
  ..startActivityForResult().then((data) {
    print(data);
  }, onError: (e) {
    print(e);
  });

add a package in your pubspec.yaml file

intent: ^1.3.4

permission in manifest

<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />

Read more answers here and can also refer here

Rajnish Sharma
  • 390
  • 2
  • 14