Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

License

NotificationsYou must be signed in to change notification settings

miguelpruivo/flutter_file_picker

Repository files navigation

fluter_file_picker

File PickerAwesome FlutterBuy me a coffeeGitHub issues badgeGitHub license badgeCI 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 usingcustom format filtering — you can provide a list of file extensions (pdf, svg, zip, etc.)
  • Pick files fromcloud 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
  • Picking both files and directories simultaneously
  • 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

APIAndroidiOSLinuxmacOSWindowsWeb
clearTemporaryFiles()
getDirectoryPath()
pickFileAndDirectoryPaths()
pickFiles()
saveFile()

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

Documentation

See theFile 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=awaitFilePicker.platform.pickFiles();if (result!=null) {File file=File(result.files.single.path!);}else {// User canceled the picker}

Multiple files

FilePickerResult? result=awaitFilePicker.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=awaitFilePicker.platform.pickFiles(  allowMultiple:true,  type:FileType.custom,  allowedExtensions: ['jpg','pdf','doc'],);

Pick a directory

String? selectedDirectory=awaitFilePicker.platform.getDirectoryPath();if (selectedDirectory==null) {// User canceled the picker}

Save-file / save-as dialog

String? outputFile=awaitFilePicker.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=awaitFilePicker.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=awaitFilePicker.platform.pickFiles();if (result!=null) {// All filesList<XFile> xFiles= result.xFiles;// IndividuallyXFile xFile= result.files.first.xFile;}else {// User canceled the picker}

Pick and upload a file to Firebase Storage with Flutter Web

FilePickerResult? result=awaitFilePicker.platform.pickFiles();if (result!=null) {Uint8List fileBytes= result.files.first.bytes;String fileName= result.files.first.name;// Upload fileawaitFirebaseStorage.instance.ref('uploads/$fileName').putData(fileBytes);}

For full usage details refer to theWiki above.

Example App

Android

DemoAndroid

iOS

DemoMultiFilters

MacOS

DemoMacOS

Linux

DemoLinux

Windows

DemoWindows

Getting Started

For help getting started with Flutter, view our onlinedocumentation.

For help on editing plugin code, view thedocumentation.

About

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

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp