Is there any way I can uninstall an app from my device using Flutter?

352

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

Share:
352
Tushar Kumar
Author by

Tushar Kumar

Updated on December 21, 2022

Comments