HomeiOS DevelopmentHow can I learn in a file from the Downloads/Paperwork folder in...

How can I learn in a file from the Downloads/Paperwork folder in iOS with my flutter app?


I’m utilizing one app to save lots of a information to the native gadget storage. I then need to learn that file in with my Flutter app.

Once I open the ‘Information’ app on iOS, I can affirm the information exists once I go to “On My Telephone”.

I’ve written the next two capabilities in my Flutter app. The paperwork listing returns an inventory of measurement 0, and the downloads listing doesn’t exist in any respect (though is definitely does).

void printAllFilesInDocsDir() async {
    attempt {
      var docsDir = await getApplicationDocumentsDirectory();
      Record<FileSystemEntity> information = docsDir.listSync();
      for (FileSystemEntity file in information) {
        print(file.path);
      }
    } catch(e) {
      print("Did not learn file: $e");
    }
  }

  void printAllFilesInDownloadsDir() async {
    attempt {
      var docsDir = await getDownloadsDirectory();
      Record<FileSystemEntity> information = docsDir!.listSync();
      for (FileSystemEntity file in information) {
        print(file.path);
      }
    } catch(e) {
      print("Did not learn file: $e");
    }
  }

I’ve added the next to my information.plist.

key>UIFileSharingEnabled</key>
    <true/>
    <key>NSPhotoLibraryUsageDescription</key>
    <string>$(PRODUCT_NAME) wish to entry your picture library</string>
    <key>NSMicrophoneUsageDescription</key>
    <string>$(PRODUCT_NAME) wish to entry your microphone</string>
    <key>NSCameraUsageDescription</key>
    <string>$(PRODUCT_NAME) wish to entry your digital camera</string>
    <key>NSCalendarsUsageDescription</key>
    <string>$(PRODUCT_NAME) wish to entry your calendar</string>
    <key>NSContactsUsageDescription</key>
    <string>$(PRODUCT_NAME) wish to entry your contacts</string>
    <key>NSLocationWhenInUseUsageDescription</key>
    <string>$(PRODUCT_NAME) wish to entry your location</string>
    <key>NSLocationAlwaysUsageDescription</key>
    <string>$(PRODUCT_NAME) wish to entry your location</string>
    <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
    <string>$(PRODUCT_NAME) wish to entry your location</string>
    <key>NSFileProviderDomainUsageDescription</key>
    <string>$(PRODUCT_NAME) wish to entry information in your gadget</string>

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments