file_picker_patch 1.0.0+2
file_picker_patch: ^1.0.0+2 copied to clipboard

A patch over the file_picker plugin which is a package that allows you to use a native file explorer to pick single or multiple absolute file paths, with extension filtering support.

fluter_file_picker

File Picker Awesome Flutter Build Status Buy me a coffee

File Picker - Patch #

Flutter plugin built over file_picker plugin as a patch for fixes

  1. Android- Crashes on picking multiple files
  2. iOS- Black screen after picking a file on iOS version < 14

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
  • 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
  • Different default type filtering (media, image, video, audio or any)
  • Picking directories
  • Flutter Web
  • Desktop (MacOS, Linux and Windows through Flutter Go)
  • Load file data immediately into memory (Uint8List) if needed;

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

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'],
        );

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
}

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 #

Demo DemoMultiFilters

Getting Started #

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

For help on editing plugin code, view the documentation.

2
likes
105
pub points
48%
popularity

Publisher

Unknown

A patch over the file_picker plugin which is a package that allows you to use a native file explorer to pick single or multiple absolute file paths, with extension filtering support.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, flutter_plugin_android_lifecycle, flutter_web_plugins, plugin_platform_interface

More

Packages that depend on file_picker_patch