Skip to content
Miguel Ruivo edited this page May 8, 2020 · 26 revisions

Android

⚠ Android Q (10) - API 29 or above

Because file_picker currently doesn't support scoped storage, you'll need to set requestLegacyExternalStorage = true on your AndroidManifest.xml file, under <application>, just like so:

<application
        android:name="your app bundle"
        android:label="your app name"
        android:requestLegacyExternalStorage="true" 
        android:icon="@mipmap/ic_launcher">
  ...

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

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>
    
  • 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.

Desktop (go-flutter)

  1. Because go-flutter uses Go, you will need to install Go by following these steps.
  2. Then, follow these instructions to install hover on your machine.
  3. Now you should have all set to start with your Flutter desktop project, by following these instructions as well. If for some reason the hover commands don't work for you, just make sure you haven't missed anything from the setup.
  4. Go to your projectName/go/cmd/options.go and add the following lines
package main

import (
	... other imports ....
	
      file_picker "github.com/miguelpruivo/flutter_file_picker/go"
)

var options = []flutter.Option{
	... other plugins and options ...

	flutter.AddPlugin(&file_picker.FilePickerPlugin{}),
}
  1. All set, just do hover run and you should have your app running on Desktop with FilePicker plugin.
Clone this wiki locally