0

Is it possible to clear cache data of an app (ex. youtube) using my Flutter app. I'm trying to do something like:

var app = await DeviceApps.getApp('com.google.android.youtube');
var dir=Directory(app?.dataDir);
dir.deleteSync(recursive: true);

But I got: Unhandled Exception: FileSystemException: Deletion failed, path = '/data/user/0/com.google.android.youtube' (OS Error: No such file or directory, errno = 2)

2
  • 1
    No, apps aren't generally allowed to tamper with other apps' data Commented May 23, 2022 at 21:18
  • Tks for your answer. So, It's not possible. Commented May 23, 2022 at 21:25

2 Answers 2

1

I don't actually think it is possible to clear app data using another app, that is something needs to be handled by the OS in order to avoid data manipulation.

you can use packages like flutter_cache_manager to delete your app cache but not that of other installed apps

Sign up to request clarification or add additional context in comments.

Comments

0

Yes it is possible to delete the cache data . You can use this package flutter_cache_manager. Follow the code:

await DefaultCacheManager().emptyCache();

1 Comment

I want to delete the cache of another app like Gmail, Youtube etc etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.