androiddartflutterstoragedart-packages

How to access Internal Storage of Android in Flutter


In android we use getFileDir() and getCacheDir() for accessing the Internal Storage. I can see that there's a path_provider plugin that I can use but I can only figure out getTemporaryDirectory() which is analogous to getCacheDir() of android. So is there any alternative way of doing what getFileDir() does in Android.

Is there any other way to do this that I'm aware of, or I'm missing something.


Solution

  • From Flutter sources:

      /// Examples:
      ///
      ///  * iOS: `NSDocumentsDirectory`
      ///  * Android: The AppData directory.
      static Future<Directory> getApplicationDocumentsDirectory() async {
        return new Directory((await _pathProviderProxy.ptr.applicationDocumentsDirectory()).path);