Skip to content
Miguel Ruivo edited this page Mar 20, 2024 · 26 revisions

Android

All set, you should be ready to go as long as you concede runtime permissions (included with the plugin)!

Also lately, since Android 11 compatibility was added, you may want to make sure that you're using one of the compatible gradle versions or else you may encounter build issues such as <query> tag not being recognized.

For release builds you need to exclude androidx.lifecycle.DefaultLifecycleObserver from being obfuscated. You do that by adding a file called proguard-rules.pro in the android/app folder and fill it with the following rule: -keep class androidx.lifecycle.DefaultLifecycleObserver

Note: If your are overriding onActivityResult in your MainActivity, make sure to call super.onActivityResult(...) for unhandled activities. Otherwise picking a file might fail silently.

iOS

Since 1.7.0 sub-dependencies, you will need to add use_frameworks! to your <project root>/ios/Podfile.

target 'Runner' do
  use_frameworks!

Optional permissions

You can prevent the need for certain permissions by excluding compilation of Media, Audio or Documents picker respectively. This is achieved by including in the file <project root>/ios/Podfile the line Pod::PICKER_MEDIA = false, resp. Pod::PICKER_AUDIO = false, resp. Pod::PICKER_DOCUMENT = false before the line target 'Runner' do.

(If you do use a file picker that is included an error will be logged and no dialog is shown.)

Based on the location of the files that you are willing to pick paths, you may need to add some keys to your iOS app's Info.plist file, located in <project root>/ios/Runner/Info.plist:

  • UIBackgroundModes with the fetch and remote-notifications keys - Required if you'll be using the FileType.any or FileType.custom. Describe why your app needs to access background taks, such downloading files (from cloud services). This is called Required background modes, with the keys App download content from network and App downloads content in response to push notifications respectively in the visual editor (since both methods aren't actually overriden, not adding this property/keys may only display a warning, but shouldn't prevent its correct usage).

    <key>UIBackgroundModes</key>
    <array>
       <string>fetch</string>
       <string>remote-notification</string>
    </array>
    
  • NSAppleMusicUsageDescription - Required if you'll be using the FileType.audio. Describe why your app needs permission to access music library. This is called Privacy - Media Library Usage Description in the visual editor.

    <key>NSAppleMusicUsageDescription</key>
    <string>Explain why your app uses music</string>
    
  • UISupportsDocumentBrowser - Required if you'll want to write directly on directories. This way iOS creates an app folder for the app and the user can create and pick directories within the folder and the app has the permission to write here.

    <key>UISupportsDocumentBrowser</key>
    <true/>
    
  • LSSupportsOpeningDocumentsInPlace - Required if you'll want to open the original file instead of caching it (when using FileType.all).

    <key>LSSupportsOpeningDocumentsInPlace</key>
    <true/>
    
  • NSPhotoLibraryUsageDescription - Required if you'll be using the FileType.image or FileType.video. Describe why your app needs permission for the photo library. This is called Privacy - Photo Library Usage Description in the visual editor.

    <key>NSPhotoLibraryUsageDescription</key>
    <string>Explain why your app uses photo library</string>
    

Note: Any iOS version below 11.0, will require an Apple Developer Program account to enable CloudKit and make it possible to use the document picker (which happens when you select FileType.all, FileType.custom or any other option with getMultiFilePath()). You can read more about it here.

Web

You are good to go as long as you are on Flutter 2.0 or above.

Desktop

This package supports all desktop platforms (Linux, macOS, and Windows) since version v4.0.0. This new implementation is written entirely in Dart. It replaces the old implementation which was written in Go and required go-flutter. To use this package on macOS, Linux, or Windows, you must enable desktop platform development in your application, depending on which operating system you want to support:

$ flutter config --enable-windows-desktop
$ flutter config --enable-macos-desktop
$ flutter config --enable-linux-desktop
Clone this wiki locally