-
Notifications
You must be signed in to change notification settings - Fork 707
Setup
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.
Since 1.7.0
sub-dependencies, you will need to add use_frameworks!
to your <project root>/ios/Podfile
.
target 'Runner' do
use_frameworks!
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
orFileType.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
orFileType.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.
You are good to go as long as you are on Flutter 2.0
or above.
Desktop is supported since version 4.0.0. To use it on MacOS, Linux or Windows you'll have to enable desktop platform development on your app based on the OS that you want to support.
$ flutter config --enable-windows-desktop
$ flutter config --enable-macos-desktop
$ flutter config --enable-linux-desktop
You can read more about it here.
- Because go-flutter uses Go, you will need to install Go by following these steps.
- Then, follow these instructions to install hover on your machine.
- 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. - 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{}),
}
- All set, just do
hover run
and you should have your app running on Desktop with FilePicker plugin.