Coder Social home page Coder Social logo

miguelpruivo / flutter_file_picker Goto Github PK

View Code? Open in Web Editor NEW
1.3K 20.0 602.0 41.08 MB

File picker plugin for Flutter, compatible with mobile (iOS & Android), Web, Desktop (Mac, Linux, Windows) platforms with Flutter Go support.

License: MIT License

Java 18.34% Ruby 1.00% Objective-C 15.57% Dart 48.59% HTML 0.38% Kotlin 0.11% Swift 0.21% CMake 6.91% C++ 8.36% C 0.53%
flutter flutter-plugin ios android dart macos windows linux golang

flutter_file_picker's Introduction

fluter_file_picker

File Picker Awesome Flutter Buy me a coffee CI pipeline status

File Picker

A package that allows you to use the native file explorer to pick single or multiple files, with extensions filtering support.

Currently supported features

  • Uses OS default native pickers
  • Supports multiple platforms (Mobile, Web, Desktop)
  • Pick files using custom format filtering — you can provide a list of file extensions (pdf, svg, zip, etc.)
  • Pick files from cloud files (GDrive, Dropbox, iCloud)
  • Single or multiple file picks
  • Supports retrieving as XFile (cross_file) for easy manipulation with other libraries
  • Different default type filtering (media, image, video, audio or any)
  • Picking directories
  • Load file data immediately into memory (Uint8List) if needed;
  • Open a save-file / save-as dialog (a dialog that lets the user specify the drive, directory, and name of a file to save)

If you have any feature that you want to see in this package, please feel free to issue a suggestion. 🎉

Compatibility Chart

API Android iOS Linux macOS Windows Web
clearTemporaryFiles() ✔️ ✔️
getDirectoryPath() ✔️ ✔️ ✔️ ✔️ ✔️
pickFiles() ✔️ ✔️ ✔️ ✔️ ✔️ ✔️
saveFile() ✔️ ✔️ ✔️ ✔️ ✔️

See the API section of the File Picker Wiki or the official API reference on pub.dev for further details.

Documentation

See the File Picker Wiki for every detail on about how to install, setup and use it.

File Picker Wiki

  1. Installation
  2. Setup
  3. API
  4. FAQ
  5. Troubleshooting

Usage

Quick simple usage example:

Single file

FilePickerResult? result = await FilePicker.platform.pickFiles();

if (result != null) {
  File file = File(result.files.single.path!);
} else {
  // User canceled the picker
}

Multiple files

FilePickerResult? result = await FilePicker.platform.pickFiles(allowMultiple: true);

if (result != null) {
  List<File> files = result.paths.map((path) => File(path!)).toList();
} else {
  // User canceled the picker
}

Multiple files with extension filter

FilePickerResult? result = await FilePicker.platform.pickFiles(
  type: FileType.custom,
  allowedExtensions: ['jpg', 'pdf', 'doc'],
);

Pick a directory

String? selectedDirectory = await FilePicker.platform.getDirectoryPath();

if (selectedDirectory == null) {
  // User canceled the picker
}

Save-file / save-as dialog

String? outputFile = await FilePicker.platform.saveFile(
  dialogTitle: 'Please select an output file:',
  fileName: 'output-file.pdf',
);

if (outputFile == null) {
  // User canceled the picker
}

Load result and file details

FilePickerResult? result = await FilePicker.platform.pickFiles();

if (result != null) {
  PlatformFile file = result.files.first;

  print(file.name);
  print(file.bytes);
  print(file.size);
  print(file.extension);
  print(file.path);
} else {
  // User canceled the picker
}

Retrieve all files as XFiles or individually

FilePickerResult? result = await FilePicker.platform.pickFiles();

if (result != null) {
  // All files
  List<XFile> xFiles = result.xFiles;

  // Individually
  XFile xFile = result.files.first.xFile;
} else {
  // User canceled the picker
}

Pick and upload a file to Firebase Storage with Flutter Web

FilePickerResult? result = await FilePicker.platform.pickFiles();

if (result != null) {
  Uint8List fileBytes = result.files.first.bytes;
  String fileName = result.files.first.name;
  
  // Upload file
  await FirebaseStorage.instance.ref('uploads/$fileName').putData(fileBytes);
}

For full usage details refer to the Wiki above.

Example App

Android

DemoAndroid

iOS

DemoMultiFilters

MacOS

DemoMacOS

Linux

DemoLinux

Windows

DemoWindows

Getting Started

For help getting started with Flutter, view our online documentation.

For help on editing plugin code, view the documentation.

flutter_file_picker's People

Contributors

abhi16180 avatar alexmercerind avatar amrgetment avatar andreaszapf avatar angeloavv avatar aulig avatar edu-hernandez-vm avatar gabrielaraujo avatar guidotheelen avatar ishangavidusha avatar jonasbadstuebner avatar kirill-21 avatar miguelpruivo avatar mnipritom avatar mutairibassam avatar nagibazad avatar navaronbracke avatar omarmgerbie avatar patrickwehriopwoco avatar philenius avatar samoy avatar softwyer avatar sylphiawindy avatar test0terter0n avatar twinkles-twinstar avatar vadympinchuk avatar victordmp avatar vinicioshenriques avatar vito-go avatar w1th0utnam3 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flutter_file_picker's Issues

Does not get absolute paths as claimed. Cannot write to a .txt file

I don't understand what this can and can't do.

Can it be used to write to files? I'm getting errors? You say it returns absolute file paths, but that does not look to be true. It seems to copy the filename only, not the path, and put it in private external storage, especially, cache.

So this is not really a file picker. It only copies files temporarily to cache?

Migrate to Android X

Many plugins on pub migrated to Android X. It would be very useful if the dependecies could be updated to use Android X instead of the Support Library.

Example fails to run

When running flutter packages get the following error is returned:

Because every version of flutter from sdk depends on meta 1.1.5 and every version of file_picker depends on meta ^1.1.6, flutter from sdk is incompatible with file_picker.
So, because basicapp depends on both file_picker any and flutter any from sdk, version solving failed.                                                                            
pub get failed (1)

Any workaround?

Cannot open document with URI: com.android.providers.downloads.documents .

Cannot open document with URI: com.android.providers.downloads.documents.
App crashes when attaching document of above URI with below error :

I/FilePicker( 7038): Checking permission: android.permission.WRITE_EXTERNAL_STORAGE
I/FilePicker( 7038): Checking permission: android.permission.WRITE_EXTERNAL_STORAGE
I/FilePicker( 7038): URI:content://com.android.providers.downloads.documents/document/2350
E/FilePathPicker( 7038): +++ API 19 URI :: content://com.android.providers.downloads.documents/document/2350
E/FilePathPicker( 7038): +++ Document URI
E/FilePathPicker( 7038): +++ Downloads External Document URI
D/AndroidRuntime( 7038): Shutting down VM
E/AndroidRuntime( 7038): FATAL EXCEPTION: main
E/AndroidRuntime( 7038): Process: com.coromandel.ideaspace, PID: 7038
E/AndroidRuntime( 7038): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=43, result=-1, data=Intent { dat=content://com.android.providers.downloads.documents/document/2350 flg=0x43 }} to activity {com.coromandel.ideaspace/com.coromandel.ideaspace.MainActivity}: java.lang.IllegalArgumentException: Unknown URI: content://downloads/public_downloads/2350
E/AndroidRuntime( 7038): 	at android.app.ActivityThread.deliverResults(ActivityThread.java:4440)
E/AndroidRuntime( 7038): 	at android.app.ActivityThread.handleSendResult(ActivityThread.java:4484)
E/AndroidRuntime( 7038): 	at android.app.ActivityThread.-wrap19(Unknown Source:0)
E/AndroidRuntime( 7038): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1743)
E/AndroidRuntime( 7038): 	at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime( 7038): 	at android.os.Looper.loop(Looper.java:164)
E/AndroidRuntime( 7038): 	at android.app.ActivityThread.main(ActivityThread.java:6753)
E/AndroidRuntime( 7038): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 7038): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:482)
E/AndroidRuntime( 7038): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
E/AndroidRuntime( 7038): Caused by: java.lang.IllegalArgumentException: Unknown URI: content://downloads/public_downloads/2350
E/AndroidRuntime( 7038): 	at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:165)
E/AndroidRuntime( 7038): 	at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135)
E/AndroidRuntime( 7038): 	at android.content.ContentProviderProxy.query(ContentProviderNative.java:432)
E/AndroidRuntime( 7038): 	at android.content.ContentResolver.query(ContentResolver.java:793)
E/AndroidRuntime( 7038): 	at android.content.ContentResolver.query(ContentResolver.java:712)
E/AndroidRuntime( 7038): 	at android.content.ContentResolver.query(ContentResolver.java:670)
E/AndroidRuntime( 7038): 	at com.mr.flutter.plugin.filepicker.FilePath.getDataColumn(FilePath.java:121)
E/AndroidRuntime( 7038): 	at com.mr.flutter.plugin.filepicker.FilePath.getForApi19(FilePath.java:66)
E/AndroidRuntime( 7038): 	at com.mr.flutter.plugin.filepicker.FilePath.getPath(FilePath.java:26)
E/AndroidRuntime( 7038): 	at com.mr.flutter.plugin.filepicker.FilePickerPlugin$1.onActivityResult(FilePickerPlugin.java:49)
E/AndroidRuntime( 7038): 	at io.flutter.app.FlutterPluginRegistry.onActivityResult(FlutterPluginRegistry.java:210)
E/AndroidRuntime( 7038): 	at io.flutter.app.FlutterActivityDelegate.onActivityResult(FlutterActivityDelegate.java:139)
E/AndroidRuntime( 7038): 	at io.flutter.app.FlutterActivity.onActivityResult(FlutterActivity.java:138)
E/AndroidRuntime( 7038): 	at android.app.Activity.dispatchActivityResult(Activity.java:7317)
E/AndroidRuntime( 7038): 	at android.app.ActivityThread.deliverResults(ActivityThread.java:4436)
E/AndroidRuntime( 7038): 	... 9 more
W/OPDiagnose( 7038): getService:OPDiagnoseService NULL
D/OSTracker( 7038): OS Event: crash

Multiple File Types

Hello Miquel,

I'm working on an application where i want to allow different kind of file types as described in #27.

I have read that you maybe were going to implement this feature in the future. I was wondering if this possible feature was still on your to-do list because i could really use it.

Thanks for your great work on this, really love how compact and smooth it works.

Thanks in advance,
SJente

Lack of cancel handling in Android, possibly memory leaks

Hello Miguel,

I'm working on an application using this excellent plugin, and I noticed that FilePicker does not callback if I close file picker in Android.

Because of this, await FilePicker.getFilePath() function call never returns, and occurs memory leaks.

https://github.com/miguelpruivo/plugins_flutter_file_picker/blob/master/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java#L50

if user closes file manager, OS calls onActivityResult() and sets resultCode to Activity.RESULT_CANCEL.

Add support for picking a directory

Usage scenario: To export data from an app user must be able to select an output directory where to save the file. Tip for iOS implementation: see UIDocumentPickerMode.ExportToService

Crashes if other file manager is selected

I'm working in the android emulator, I have Simple File Manager installed from F-Droid, and if I try to select a file from there, my app crashes.

Here is a screenshot of the File Manager selector being on left.

So if I select say Documents/cone/.cone.ledger.txt, the app crashes. Here are the some of the lines I find in flutter run.

(In particular the issue seems to be that the file manager is returning URI:content://com.simplemobiletools.filemanager.pro.provider/external_files/storage/emulated/0/Documents/cone/.cone.ledger.txt.)

I/SimplePermission(11587): Checking permission : android.permission.WRITE_EXTERNAL_STORAGE
I/FilePicker(11587): Custom file type: text/plain
I/FilePicker(11587): Checking permission: android.permission.WRITE_EXTERNAL_STORAGE
D/FilePicker(11587): Intent: Intent { act=android.intent.action.GET_CONTENT cat=[android.intent.category.OPENABLE] typ=text/plain }
D/EGL_emulation(11587): eglMakeCurrent: 0xdef056c0: ver 3 0 (tinfo 0xdef03fa0)
I/FilePicker(11587): URI:content://com.simplemobiletools.filemanager.pro.provider/external_files/storage/emulated/0/Documents/cone/.cone.ledger.txt
E/FilePathPicker(11587): +++ API 19 URI :: content://com.simplemobiletools.filemanager.pro.provider/external_files/storage/emulated/0/Documents/cone/.cone.ledger.txt
E/FilePathPicker(11587): +++ No DOCUMENT URI :: CONTENT 
D/AndroidRuntime(11587): Shutting down VM
E/AndroidRuntime(11587): FATAL EXCEPTION: main
E/AndroidRuntime(11587): Process: info.tangential.cone, PID: 11587
E/AndroidRuntime(11587): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=95162922, result=-1, data=Intent { dat=content://com.simplemobiletools.filemanager.pro.provider/external_files/storage/emulated/0/Documents/cone/.cone.ledger.txt typ=text/plain flg=0x1 }} to activity {info.tangential.cone/info.tangential.cone.MainActivity}: java.lang.IllegalArgumentException: column '_data' does not exist. Available columns: []
E/AndroidRuntime(11587): 	at android.app.ActivityThread.deliverResults(ActivityThread.java:4360)
E/AndroidRuntime(11587): 	at android.app.ActivityThread.handleSendResult(ActivityThread.java:4402)
E/AndroidRuntime(11587): 	at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49)
E/AndroidRuntime(11587): 	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
E/AndroidRuntime(11587): 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
E/AndroidRuntime(11587): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
E/AndroidRuntime(11587): 	at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime(11587): 	at android.os.Looper.loop(Looper.java:193)
E/AndroidRuntime(11587): 	at android.app.ActivityThread.main(ActivityThread.java:6669)
E/AndroidRuntime(11587): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(11587): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
E/AndroidRuntime(11587): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
E/AndroidRuntime(11587): Caused by: java.lang.IllegalArgumentException: column '_data' does not exist. Available columns: []
E/AndroidRuntime(11587): 	at android.database.AbstractCursor.getColumnIndexOrThrow(AbstractCursor.java:340)
E/AndroidRuntime(11587): 	at android.database.CursorWrapper.getColumnIndexOrThrow(CursorWrapper.java:87)
E/AndroidRuntime(11587): 	at com.mr.flutter.plugin.filepicker.FileUtils.getDataColumn(FileUtils.java:129)
E/AndroidRuntime(11587): 	at com.mr.flutter.plugin.filepicker.FileUtils.getForApi19(FileUtils.java:110)
E/AndroidRuntime(11587): 	at com.mr.flutter.plugin.filepicker.FileUtils.getPath(FileUtils.java:27)
E/AndroidRuntime(11587): 	at com.mr.flutter.plugin.filepicker.FilePickerPlugin$1.onActivityResult(FilePickerPlugin.java:55)
E/AndroidRuntime(11587): 	at io.flutter.app.FlutterPluginRegistry.onActivityResult(FlutterPluginRegistry.java:210)
E/AndroidRuntime(11587): 	at io.flutter.app.FlutterActivityDelegate.onActivityResult(FlutterActivityDelegate.java:139)
E/AndroidRuntime(11587): 	at io.flutter.app.FlutterActivity.onActivityResult(FlutterActivity.java:138)
E/AndroidRuntime(11587): 	at android.app.Activity.dispatchActivityResult(Activity.java:7454)
E/AndroidRuntime(11587): 	at android.app.ActivityThread.deliverResults(ActivityThread.java:4353)
E/AndroidRuntime(11587): 	... 11 more
I/Process (11587): Sending signal. PID: 11587 SIG: 9
Lost connection to device.

Here is the particular commit at which this occurs for me: https://github.com/bradyt/cone/tree/ce9ba96dce29e855fe08e4114b08779d4dda2f2e.

Add different file types

I do not understand why only PDF files are allowed.
Could you provide an option to select any type of file (any file ending or specified file ending)?

Permission callbacks called even when not requested

My App needs a few permissions to work, like Location or "ReadExternalStorage".
I will use the simple_permissions plugin to gather the location permission.
However, once that permission is granted, the file_picker callback at https://github.com/miguelpruivo/plugins_flutter_file_picker/blob/e496cfc060d724b1da46f295e4085cb9748448d3/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java#L99 will be called as well. This causes a crash:

java.lang.RuntimeException: Failure delivering result ResultInfo{who=@android:requestPermissions:, request=0, result=-1, data=Intent { act=android.content.
pm.action.REQUEST_PERMISSIONS (has extras) }} to activity {com.company.app/com.company.app.MainActivity}: android.content.Activ
ityNotFoundException: No Activity found to handle Intent { act=android.intent.action.GET_CONTENT cat=[android.intent.category.OPENABLE] }
    at android.app.ActivityThread.deliverResults(ActivityThread.java:4361)
    at android.app.ActivityThread.handleSendResult(ActivityThread.java:4403)
    at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49)
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1809)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6680)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.GET_CONTENT cat=[android.intent.catego
ry.OPENABLE] }
    at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2007)
    at android.app.Instrumentation.execStartActivity(Instrumentation.java:1673)
    at android.app.Activity.startActivityForResult(Activity.java:4586)
    at android.app.Activity.startActivityForResult(Activity.java:4544)
    at com.mr.flutter.plugin.filepicker.FilePickerPlugin.startFileExplorer(FilePickerPlugin.java:163)
    at com.mr.flutter.plugin.filepicker.FilePickerPlugin.access$300(FilePickerPlugin.java:26)
    at com.mr.flutter.plugin.filepicker.FilePickerPlugin$2.onRequestPermissionsResult(FilePickerPlugin.java:99)
    at io.flutter.app.FlutterPluginRegistry.onRequestPermissionsResult(FlutterPluginRegistry.java:191)
    at io.flutter.app.FlutterActivityDelegate.onRequestPermissionsResult(FlutterActivityDelegate.java:125)
    at io.flutter.app.FlutterActivity.onRequestPermissionsResult(FlutterActivity.java:133)
    at android.app.Activity.dispatchRequestPermissionsResult(Activity.java:7616)
    at android.app.Activity.dispatchActivityResult(Activity.java:7466)
    at android.app.ActivityThread.deliverResults(ActivityThread.java:4354)
    ... 11 more

From my point of view, the plugin should not rely on a static request code of zero (which may be used by other plugins, indeed) but perhaps a .hashCode() number based on the plugin name.

Support handling com.google.android.apps.docs.storage

Cannot handle document with URI: com.google.android.apps.docs.storage

Always result same file path /data/user/0/com.example.omahdana/cache/Document

I/FilePicker(12230): Checking permission: android.permission.WRITE_EXTERNAL_STORAGE
I/FilePicker(12230): URI:content://com.google.android.apps.docs.storage/document/acc%3D1%3Bdoc%3D1707
E/FilePathPicker(12230): +++ API 19 URI :: content://com.google.android.apps.docs.storage/document/acc%3D1%3Bdoc%3D1707
E/FilePathPicker(12230): +++ Document URI
I/FilePicker(12230): Loaded file from cloud created on:/data/user/0/com.example.omahdana/cache/Document
I/FilePicker(12230): Absolute file path:/data/user/0/com.example.omahdana/cache/Document
I/flutter (12230): File path: /data/user/0/com.example.omahdana/cache/Document

Error with permission checker and android_alarm_manager

Hi,

I'm getting the following error when I have both file_picker and android_alarm_manager packages installed:

E/MethodChannel#file_picker( 3336): java.lang.NullPointerException: Attempt to invoke virtual method 'int android.content.Context.checkPermission(java.lang.String, int, int)' on a null object reference E/MethodChannel#file_picker( 3336): at androidx.core.content.ContextCompat.checkSelfPermission(ContextCompat.java:544) E/MethodChannel#file_picker( 3336): at com.mr.flutter.plugin.filepicker.FilePickerPlugin.checkPermission(FilePickerPlugin.java:127) E/MethodChannel#file_picker( 3336): at com.mr.flutter.plugin.filepicker.FilePickerPlugin.startFileExplorer(FilePickerPlugin.java:169) E/MethodChannel#file_picker( 3336): at com.mr.flutter.plugin.filepicker.FilePickerPlugin.onMethodCall(FilePickerPlugin.java:119) E/MethodChannel#file_picker( 3336): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:201) E/MethodChannel#file_picker( 3336): at io.flutter.view.FlutterNativeView$PlatformMessageHandlerImpl.handleMessageFromDart(FlutterNativeView.java:188) E/MethodChannel#file_picker( 3336): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:202) E/MethodChannel#file_picker( 3336): at android.os.MessageQueue.nativePollOnce(Native Method) E/MethodChannel#file_picker( 3336): at android.os.MessageQueue.next(MessageQueue.java:325) E/MethodChannel#file_picker( 3336): at android.os.Looper.loop(Looper.java:142) E/MethodChannel#file_picker( 3336): at android.app.ActivityThread.main(ActivityThread.java:6541) E/MethodChannel#file_picker( 3336): at java.lang.reflect.Method.invoke(Native Method) E/MethodChannel#file_picker( 3336): at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) E/MethodChannel#file_picker( 3336): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

I replicated this in a clean project with the following in the pubspec.yaml:

android_alarm_manager: ^0.4.1+6
file_picker: ^1.3.3

Flutter doctor:
[√] Flutter (Channel stable, v1.2.1, on Microsoft Windows [Version 10.0.17134.648], locale en-ZA) [√] Android toolchain - develop for Android devices (Android SDK version 28.0.3) [√] Android Studio (version 3.3) [√] Android Studio (version 3.0) [√] IntelliJ IDEA Community Edition (version 2018.3) [√] VS Code (version 1.32.3) [√] Connected device (2 available)

Thanks!

FilePickerPlugin.java does not close the output/input streams it opens

FilePickerPlugin.java does not close any of the output or input streams it opens. For a sample how to do this correctly, see e.g. https://javarevisited.blogspot.com/2014/10/right-way-to-close-inputstream-file-resource-in-java.html

I think this is quite high level issue in this plugin. I see some random FileNotFoundExceptions in my app (for some users/devices this happens always). This is most probably caused by this issue in this plugin (accessing a file picked with this plugin fails because the file is still reserved by the plugin).

As a related comment, I am not sure is it a good idea to try/catch errors in the onActivityResult method. It will just hide errors, the error should be delivered to plugin caller.

Selecting a single image from Google Photos does not work

If FilePicker.getFilePath() is used and an image is added via the default file chooser + Google Photos an error occurs.

E/flutter: [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: type 'List<dynamic>' is not a subtype of type 'String'
#0 FilePicker.getFile (package:file_picker/file_picker.dart:42:18)

The reason for this problem is Google Photos and not this plugin. Even if only one file is requested Google Photos returns a list of elements, with one entry. It seems like a good idea to verify the returned data and wrap it if necessary. I will attach a PR which fixes the problem.

File Picker window not open

Hello @miguelpruivo,

I have applied the same code from example but I am getting given below error:

I/flutter ( 7186): [FilePicker] Unsupported operation. Method not found. The exception thrown was: MissingPluginException(No implementation found for method ANY on channel file_picker)

Please help me out.

Multiple dex files define Landroid/support/v4/os/ResultReceiver;

I have been getting this error when I include file_picker in my project and would like some help! I tried removing file_picker and seems like everything builds successfully.

Dex: Error converting bytecode to dex:                                  
Cause: com.android.dex.DexException: Multiple dex files define Landroid/support/v4/os/ResultReceiver;
    UNEXPECTED TOP-LEVEL EXCEPTION:                                     
    com.android.dex.DexException: Multiple dex files define Landroid/support/v4/os/ResultReceiver;
                                                                        
com.android.dex.DexException: Multiple dex files define Landroid/support/v4/os/ResultReceiver;
        at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:661)
        at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:616)
        at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:598)
        at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
        at com.android.dx.merge.DexMerger.merge(DexMerger.java:198)     
        at com.android.builder.dexing.DexArchiveMergerCallable.call(DexArchiveMergerCallable.java:61)
        at com.android.builder.dexing.DexArchiveMergerCallable.call(DexArchiveMergerCallable.java:36)
        at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424)
        at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
        at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
        at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
        at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Dex: Error converting bytecode to dex:                                  
Cause: com.android.dex.DexException: Multiple dex files define Landroid/support/v4/os/ResultReceiver$MyResultReceiver;
    UNEXPECTED TOP-LEVEL EXCEPTION:                                     
    com.android.dex.DexException: Multiple dex files define Landroid/support/v4/os/ResultReceiver$MyResultReceiver;
                                                                        
com.android.dex.DexException: Multiple dex files define Landroid/support/v4/os/ResultReceiver$MyResultReceiver;
        at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:661)
        at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:616)
        at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:598)
        at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
        at com.android.dx.merge.DexMerger.merge(DexMerger.java:198)     
        at com.android.builder.dexing.DexArchiveMergerCallable.call(DexArchiveMergerCallable.java:61)
        at com.android.builder.dexing.DexArchiveMergerCallable.call(DexArchiveMergerCallable.java:36)
        at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424)
        at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
        at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
        at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
        at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
                                                                        
FAILURE: Build failed with an exception.                                
                                                                        
* What went wrong:                                                      
Execution failed for task ':app:transformDexArchiveWithDexMergerForDevelopmentDebug'.
> com.android.build.api.transform.TransformException: com.android.dex.DexException: Multiple dex files define Landroid/support/v4/os/ResultReceiver$MyResultReceiver;
                                                                        
dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter

  intl: ^0.15.6
  intl_translation: ^0.17.0
  google_sign_in: ^3.0.0
  firebase_core: ^0.2.5+1
  firebase_analytics: ^1.0.6
  firebase_auth: ^0.6.6
  firebase_messaging: ^2.1.0
  firebase_database: ^1.0.5
  firebase_storage: ^1.0.4
  firebase_performance: ^0.0.8+1
  cloud_firestore: ^0.8.2+3
  shared_preferences: ^0.4.2
  charts_flutter: ^0.4.0
  flutter_circular_chart: ^0.1.0
  fcharts: ^0.0.9
  modern_charts: ^0.1.16
  image: ^2.0.4
  cached_network_image: ^0.5.1
  transparent_image: ^0.1.0
  image_picker: ^0.4.12+1
  file_picker: ^1.3.1
  open_file: ^1.2.0

  recase: ^2.0.0+1
  random_string: ^0.0.2
  flutter_linkify: ^1.1.1

  flutter_launcher_icons: ^0.7.0
  flushbar: ^0.9.2
  http: ^0.12.0
  url_launcher: ^4.0.3
  path_provider: ^0.4.1
  package_info: ^0.3.2
  device_info: ^0.3.0

  cupertino_icons: ^0.1.0
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

def keystorePropertiesFile = rootProject.file("key.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

android {
    compileSdkVersion 28

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        applicationId "com.xxxxxxxxx"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 17
        versionName "0.7.3"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }

    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
        }
    }
    buildTypes {
        release {
            signingConfig signingConfigs.release

            minifyEnabled true
            useProguard true

            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    flavorDimensions "flavor-type"

    productFlavors {
        development {
            dimension "flavor-type"
            applicationIdSuffix ".dev"
            versionNameSuffix "-dev"

        }
        production {
            dimension "flavor-type"
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}

apply plugin: 'com.google.gms.google-services'

FileName and Path is showing null

_openFileExplorer() async {
if (_pickingType != FileType.CUSTOM || _hasValidMime) {
try {
if (_multiPick) {
_path = null;
_paths = await FilePicker.getMultiFilePath(type: _pickingType, fileExtension: _extension);
} else {
_paths = null;
_path = await FilePicker.getFilePath(type: _pickingType, fileExtension: _extension);
}
} on PlatformException catch (e) {
print("Unsupported operation" + e.toString());
}
if (!mounted) return;

  setState(() {
    _fileName = _path != null ? _path.split('/').last : _paths != null ? _paths.keys.toString() : '...';
  });
  File file=new File(_path);
  print("Path $file");
  print("FileName $_fileName");
  print(lookupMimeType(_path));
}

}

I/FilePicker(11562): [SingleFilePick] File URI:content://com.android.providers.downloads.documents/document/235
E/FilePickerUtils(11562): Getting for API 19 or abovecontent://com.android.providers.downloads.documents/document/235
E/FilePickerUtils(11562): Document URI
E/FilePickerUtils(11562): Downloads External Document URI
E/FilePickerUtils(11562): Something went wrong while retrieving document path: java.lang.IllegalArgumentException: Unknown URI: content://downloads/public_downloads/235
E/FilePickerUtils(11562): Something went wrong while retrieving document path: java.lang.SecurityException: Permission Denial: reading com.android.providers.downloads.DownloadProvider uri content://downloads/all_downloads/235 from pid=11562, uid=10292 requires android.permission.ACCESS_ALL_DOWNLOADS, or grantUriPermission()
I/FilePickerUtils(11562): Remote file loaded and cached at:/data/user/0/com.cbtech.cb_curemantra/cache/null
I/FilePicker(11562): Absolute file path:/data/user/0/com.cbtech.cb_curemantra/cache/null
I/flutter (11562): Path File: '/data/user/0/com.cbtech.cb_curemantra/cache/null'
I/flutter (11562): FileName null
V/PhoneWindow(11562): DecorView setVisiblity: visibility = 0, Parent = android.view.ViewRootImpl@5e1c312, this = DecorView@c7bbae3[MainActivity]
D/Surface (11562): Surface::connect(this=0x75f615a000,api=1)
D/mali_winsys(11562): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
D/Surface (11562): Surface::connect(this=0x75f615b000,api=1)
D/mali_winsys(11562): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
I/flutter (11562): null

Cancel picking a file and then pick again throws an error and breaks the app

Try to cancel the first request of picking the file and then reopen the file picker. It throws a Platform Exception which, is not being caught in PlatformException


    Future getBrochure() async {
    try {
      await FilePicker.getFilePath(type: FileType.ANY)
          .catchError((error) => print(error))
          .then((brochure_path) {
            print("Completed");
        if (brochure_path != "" || brochure_path != null) {
          print("fired");
          setState(() {
            brochure = File(brochure_path);
          });
        }
      });
    } on PlatformException catch (e) {
      print(e);
    }
  }

Consider upgrading to image_picker 0.5.0+3

Newer version fixes few crashes while switching to & fro through platform channel. So, may be you could upgrade image_picker to 0.5.0+3 and re-publish the package.
Thank you!

Multiple file extensions when using getMultiFilePath()

Hey, I've seen 2 issues before me, #42 and #32 .
The questions are both closed but I can't seem to find a mention of this feature being added in the changelog.

For clarification, I'm looking to pick multiple files of a pre-defined extension (for example .jpg and .mp4).

Maybe I have missed it somewhere, if so, apologies.

Cannot build for Android (version 1.3.4)

Trying to build with version 1.3.4 and getting the following error:

`FAILURE: Build failed with an exception.

  • What went wrong:
    Could not resolve all files for configuration ':file_picker:debugCompileClasspath'.

Failed to transform file 'flutter.jar' to match attributes {artifactType=processed-jar} using transform JetifyTransform
Failed to transform '/Users/miguelruivo/DevTools/flutter/bin/cache/artifacts/engine/android-arm64/flutter.jar' using Jetifier. Reason: Cannot open a library at 'FileMapping(from=/Users/miguelruivo/DevTools/flutter/bin/cache/artifacts/engine/android-arm64/flutter.jar, to=/home/chris/.gradle/caches/transforms-1/files-1.1/flutter.jar/238118fc2d1bd61f2da6041b9800dfc1/jetified-flutter.jar)'. (Run with --stacktrace for more details.)
`

Project builds fine with version 1.3.3.

Issue with gauriinfotech

This Android dependency: https://github.com/miguelpruivo/plugins_flutter_file_picker/blob/1f83dfa776e667552cbc435690ca2cac7e5e9159/android/build.gradle#L37
It is causing an issue, which prevents the application to build, i.e. the following:

* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed
Attribute application@label value=(ANDROID_APP_NAME) from AndroidManifest.xml:17:9-28
	is also present at [in.gauriinfotech:commons:1.0.8] AndroidManifest.xml:13:9-41 value=(@string/app_name).
	Suggestion: add 'tools:replace="android:label"' to <application> element at AndroidManifest.xml:15:5-38:19 to override.

I am not sure for what this dependency is required, but this is definitely an issue. I also do not know if this is even fixable in the plugin without removing the dependency.

Errors while building on android device

Hi, I m receiving errors while building project for android devices. I searched for the solution but no idea about it. any idea?

/Users/bilalsimsek/Desktop/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.1.1/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:10: error: cannot find symbol
import android.support.v4.app.ActivityCompat;
^
symbol: class ActivityCompat
location: package android.support.v4.app
/Users/bilalsimsek/Desktop/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.1.1/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:11: error: package android.support.v4.content does not exist
import android.support.v4.content.ContextCompat;
^
/Users/bilalsimsek/Desktop/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.1.1/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:127: error: cannot find symbol
return PackageManager.PERMISSION_GRANTED == ContextCompat.checkSelfPermission(activity, permission);
^
symbol: variable ContextCompat
location: class FilePickerPlugin
/Users/bilalsimsek/Desktop/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.1.1/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:135: error: cannot find symbol
ActivityCompat.requestPermissions(activity, perm, PERM_CODE);
^
symbol: variable ActivityCompat
location: class FilePickerPlugin

No file selected

I tried it on an Android Emulator running Android Oreo and I don't get a valid path to the selected file. Instead I get the location of the cache folder {path_to_app}/cache/Documents/.

Error while building on android device : Saying -this dependencies aren't compatible with AndroidX.

Recently I updated flutter package and after that i cant build my app.

`D8: Program type already present: android.support.v4.media.MediaBrowserCompat$CallbackHandler
*********************************************************
WARNING: This version of image_picker will break your Android build if it or its dependencies aren't compatible with AndroidX.
See https://goo.gl/CP92wY for more information on the problem and how to fix it.
This warning prints for all Android build failures. The real root cause of the error may be unrelated.
*********************************************************

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\51.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\41.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\23.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\35.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\73.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\45.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\39.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\67.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\59.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\79.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\55.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\63.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\27.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\25.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\33.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\53.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\19.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\21.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\71.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\47.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\37.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\81.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\75.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\43.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\77.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\69.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\49.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\65.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\29.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\61.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\57.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\31.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\12.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\1.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\5.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\11.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\4.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\3.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\8.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\14.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\10.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\7.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\9.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\2.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\13.jar, E:\Flutter Projects\coupled\build\app\intermediates\transforms\dexBuilder\debug\6.jar
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: android.support.v4.media.MediaBrowserCompat$CallbackHandler

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 18s
Finished with error: Gradle task assembleDebug failed with exit code 1
`

Flutter Doctor

[√] Flutter (Channel stable, v1.0.0, on Microsoft Windows [Version 10.0.17763.107], locale en-US) • Flutter version 1.0.0 at E:\flutter • Framework revision 5391447fae (3 months ago), 2018-11-29 19:41:26 -0800 • Engine revision 7375a0f414 • Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)

FileType.CUSTOM does not work with any file extension

In my app I need support for .csv and .dat file extensions (dat is a backup format in my app, it is actually a zip but I want to separate it from other zip files by file extension). Neither csv or dat seems to work with file_picker (tested in Android). Is there some platform limitation for that "custom" is not actually custom, but it is still limited to few well known file types like pdf, zip etc. If possible it would be much better that file_picker allows any file extension and just filters files by that.

Documents only FileType

It should not be hard to create FileType and filter files only by documents extensions. like pdf, doc(x), xml, txt, etc.

Is it possible to do?

Removing the need of WRITE permission

Dart:

String getPath(..., {String destinationPath});

Android:

sourceUri = choosenFile();
resolver = getContentResolver();
writeToFile(resolver, sourceUri, destinationPath);

IOS:
???

App crashes if use file_picker on iPhone 5c

Hello.
I want to use file_picker plugin in my flutter application.
In my App i use following code:
_filePath=await FilePicker.getFilePath(type: FileType.ANY, fileExtension: 'bin');

On iPad 64 it works fine, but when i run my App on iPhone 5c (iOS 10.3.3) and
try to pick a file - my App crashes with error message in debug:
Assertion failure in -[UIDocumentPickerViewController _commonInitWithCompletion:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3600.9.1/UIDocumentPickerViewController.m:91 2019-03-10 16:37:08.613635+0200 Runner[373:23247] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Application initializing document picker is missing the iCloud entitlement. Is com.apple.developer.icloud-container-identifiers set?'

How can i fix it?

Chose image from camera

Hi,
this is not an issue but a need I think at least for me. I m using file from camera and with new update its removed so I cant upgrade to latest version. its possible add it again. I dont want to additional package for this purpose. thanks.

Platform exception: Can only use lower 16 bits for requestCode

Hi,

I am getting following error when I try to select any file:

I/FilePicker(13338): Checking permission: android.permission.WRITE_EXTERNAL_STORAGE
I/FilePicker(13338): Requesting permission: android.permission.WRITE_EXTERNAL_STORAGE
E/MethodChannel#file_picker(13338): Failed to handle method call
E/MethodChannel#file_picker(13338): java.lang.IllegalArgumentException: Can only use lower 16 bits for requestCode
E/MethodChannel#file_picker(13338): at androidx.fragment.app.FragmentActivity.checkForValidRequestCode(FragmentActivity.java:696)
E/MethodChannel#file_picker(13338): at androidx.fragment.app.FragmentActivity.validateRequestPermissionsRequestCode(FragmentActivity.java:711)
E/MethodChannel#file_picker(13338): at androidx.core.app.ActivityCompat.requestPermissions(ActivityCompat.java:500)
E/MethodChannel#file_picker(13338): at com.mr.flutter.plugin.filepicker.FilePickerPlugin.requestPermission(FilePickerPlugin.java:130)
E/MethodChannel#file_picker(13338): at com.mr.flutter.plugin.filepicker.FilePickerPlugin.startFileExplorer(FilePickerPlugin.java:180)
E/MethodChannel#file_picker(13338): at com.mr.flutter.plugin.filepicker.FilePickerPlugin.onMethodCall(FilePickerPlugin.java:115)
E/MethodChannel#file_picker(13338): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:201)
E/MethodChannel#file_picker(13338): at io.flutter.view.FlutterNativeView$PlatformMessageHandlerImpl.handleMessageFromDart(FlutterNativeView.java:188)
E/MethodChannel#file_picker(13338): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:202)
E/MethodChannel#file_picker(13338): at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#file_picker(13338): at android.os.MessageQueue.next(MessageQueue.java:326)
E/MethodChannel#file_picker(13338): at android.os.Looper.loop(Looper.java:160)
E/MethodChannel#file_picker(13338): at android.app.ActivityThread.main(ActivityThread.java:6669)
E/MethodChannel#file_picker(13338): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#file_picker(13338): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
E/MethodChannel#file_picker(13338): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
I/flutter (13338): [FilePicker] Platform exception: PlatformException(error, Can only use lower 16 bits for requestCode, null)
W/ManagedChannelImpl(13338): [{0}] Failed to resolve name. status={1}

Here is the report from flutter doctor -v:

[✓] Flutter (Channel stable, v1.2.1, on Mac OS X 10.14.3 18D109, locale en-GB)
• Flutter version 1.2.1 at /Applications/flutter
• Framework revision 8661d8aecd (5 weeks ago), 2019-02-14 19:19:53 -0800
• Engine revision 3757390fa4
• Dart version 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Applications/android-sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• ANDROID_HOME = /Applications/android-sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
• All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.1, Build version 10B61
• ios-deploy 1.9.4
• CocoaPods version 1.5.3

[✓] Android Studio
• Android Studio at /Applications/Android Studio 3.5.app/Contents
• Flutter plugin version 33.4.2
• Dart plugin version 183.5901
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)

[✓] Android Studio (version 3.4)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 33.4.2
• Dart plugin version 183.5901
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)

[✓] IntelliJ IDEA Community Edition (version 2018.3.5)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin version 33.4.2
• Dart plugin version 183.5912.23

[✓] VS Code (version 1.32.3)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 2.24.0

[✓] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)

• No issues found!

App crashes if both image_picker and file_picker 1.3.0 are installed

The file_picker appears to be working fine, but any attempt to use the image_picker causes the app to crash, which will happen after a file is selected or captured by the camera, or when the user cancels selection or capture.

D/AndroidRuntime(12668): Shutting down VM
E/AndroidRuntime(12668): FATAL EXCEPTION: main
E/AndroidRuntime(12668): Process: app, PID: 12668
E/AndroidRuntime(12668): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=2343, result=-1, data=Intent { }} to activity {MainActivity}: java.lang.IllegalStateException: Reply already submitted
E/AndroidRuntime(12668): at android.app.ActivityThread.deliverResults(ActivityThread.java:4126)
E/AndroidRuntime(12668): at android.app.ActivityThread.handleSendResult(ActivityThread.java:4169)
E/AndroidRuntime(12668): at android.app.ActivityThread.-wrap20(ActivityThread.java)
E/AndroidRuntime(12668): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1552)
E/AndroidRuntime(12668): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(12668): at android.os.Looper.loop(Looper.java:154)
E/AndroidRuntime(12668): at android.app.ActivityThread.main(ActivityThread.java:6186)
E/AndroidRuntime(12668): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(12668): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
E/AndroidRuntime(12668): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
E/AndroidRuntime(12668): Caused by: java.lang.IllegalStateException: Reply already submitted
E/AndroidRuntime(12668): at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:124)
E/AndroidRuntime(12668): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.error(MethodChannel.java:209)
E/AndroidRuntime(12668): at com.mr.flutter.plugin.filepicker.FilePickerPlugin$1.onActivityResult(FilePickerPlugin.java:85)
E/AndroidRuntime(12668): at io.flutter.app.FlutterPluginRegistry.onActivityResult(FlutterPluginRegistry.java:218)
E/AndroidRuntime(12668): at io.flutter.app.FlutterActivityDelegate.onActivityResult(FlutterActivityDelegate.java:143)
E/AndroidRuntime(12668): at io.flutter.app.FlutterActivity.onActivityResult(FlutterActivity.java:142)
E/AndroidRuntime(12668): at android.app.Activity.dispatchActivityResult(Activity.java:6937)
E/AndroidRuntime(12668): at android.app.ActivityThread.deliverResults(ActivityThread.java:4122)

New feature: Multiple file picker

It would be great to have a method getFilePaths which allows the selection of multiple files, if the native picker allow this behaviour (not sure).
This method would then not return a single path, but a list/array of paths.

Does anyone know if the native file explorers support this behaviour?

Can I remove CAMERA permission?

If I don't need FileType.CAMERA.
Can I remove CAMERA permission?

If my app has CAMERA permission. I need give google play privacy policy url.

Custom filter rule.

May I custom a rule to filter the result? Such as, I want to filter the maximum size of the file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.