Go to file
Miguel Ruivo 58625339b8 Bumps to 4.0.2 2021-09-07 14:14:59 +01:00
.github/ISSUE_TEMPLATE Updates bug report template 2021-01-31 17:33:52 +00:00
android move from jcenter->mavenCentral in core plugin 2021-08-04 10:46:11 +01:00
example Updates iOS picker presentation (#813) and fixes import regression on web (#746) 2021-08-31 12:02:15 +01:00
go fixed the path :) 2021-06-03 20:02:37 +09:00
ios Updates iOS picker presentation (#813) and fixes import regression on web (#746) 2021-08-31 12:02:15 +01:00
lib Bumps to 4.0.2 2021-09-07 14:14:59 +01:00
.gitignore Updates iOS picker presentation (#813) and fixes import regression on web (#746) 2021-08-31 12:02:15 +01:00
CHANGELOG.md Bumps to 4.0.2 2021-09-07 14:14:59 +01:00
LICENSE Unifies all platforms in a single plugin with addition of new features 2020-09-11 18:52:07 +01:00
README.md Adds desktop support (#271) and onFileLoading callback to web (#766) 2021-08-10 17:54:23 +01:00
analysis_options.yaml Updates docs and removes deprecated call warnings 2021-05-26 01:00:48 +01:00
pubspec.yaml Bumps to 4.0.2 2021-09-07 14:14:59 +01:00

README.md

fluter_file_picker

File Picker Awesome Flutter Build Status Buy me a coffee

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 and Flutter GO)
  • 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
  • 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

Android

Demo

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.