'Flutter - getApplicationDocumentsDirectory() : How to get the path in android and iOS

Directory tempDir = await getTemporaryDirectory();
String tempPath = tempDir.path;

In android native code, I use getCacheDir()

How do i get the getApplicationDocumentsDirectory() path in android? When i print getFilesDir() in android it is not matching with getApplicationDocumentsDirectory()

Please tell me the equivalent in android and iOS.

Thanks



Solution 1:[1]

You may consider using path_provider plugin. The function getTemporaryDirectory() uses getCacheDir() on Android, while it uses NSCachesDirectory on iOS.

If you need storage access for user-generated data, you can use getApplicationDocumentsDirectory(). If the data is not user-generated, you can use getApplicationSupportDirectory().

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Omatt