Search packages, repositories and app categories

Package detailsv5.2.3

flutter_document_picker

Allows user pick a document. Picked document is copied to app temporary directory. Optionally allows pick document with specific extension only.

AndroidiOS
30-day downloads
18.7K
Likes
52
Pub points
150

Install package

flutter pub add flutter_document_picker

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

A Flutter package that enables users to select documents from their device's file system. The selected document is automatically copied to the app's temporary directory for safe access. It supports filtering files by specific extensions, enhancing usability for targeted file selection. Available on both Android and iOS, it integrates seamlessly with native file pickers. Ideal for apps requiring document uploads or imports without direct file system access.

Use cases

  • Document upload in forms
  • Importing user-generated files
  • File sharing between apps
  • Reading external configuration files
  • Supporting document-based workflows

Key features

  • Pick documents with extension filtering
  • Automatically copies files to temp directory
  • Cross-platform (Android & iOS)
  • Simple API integration
  • Secure temporary file handling

Suitable for

  • Apps needing file input
  • Document management features
  • User-driven file imports
  • Mobile data collection tools
  • Privacy-focused file access

Considerations

  • Files are copied to temporary storage
  • Limited to supported file types
  • Requires platform-specific permissions
  • Temporary files may be deleted on app restart
  • No direct access to original file path

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

flutter_document_picker

Allows user pick a document. Picked document is copied to app temporary directory. Optionally allows pick document with specific extension only.

When file is picked its extension is checked using allowedFileExtensions parameter. Then file is copied to app temp directory. Copied file path is returned as result. If picked file extension is not in allowedFileExtensions list then extension_mismatch error is returned.

In Android Intent.ACTION_OPEN_DOCUMENT is used. This intent is supported only from Android 19 (KitKat) SDK version. So this plugin can be used only if app minSdkVersion is 19 or more.

In iOS UIDocumentPickerViewController is used. Files can be filtered by list of UTI types using allowedUtiTypes parameter. Picked file path is returned as result.

Params

Plugin has 3 optional parameters to help pick only specific document type:

  • List<String> allowedUtiTypes (used only in iOS)

    In iOS Uniform Type Identifiers is used to check document types. If list is null or empty "public.data" document type will be provided. Only documents with provided UTI types will be enabled in iOS document picker.

    More info: https://developer.apple.com/library/archive/qa/qa1587/_index.html

  • List<String> allowedFileExtensions (used both in iOS and in Android)

    List of file extensions that picked file should have. If list is null or empty - picked document extension will not be checked.

  • List<String> allowedMimeTypes (used only in Android)

    Only files with provided MIME types will be shown in document picker. If list is null or empty - */* MIME type will be used.

  • List<String> invalidFileNameSymbols (used both in iOS and in Android)

    List symbols that will be sanitized to "_" in the selected document name. I.e. Google Drive allows symbol '/' in the document name, but this symbol is not allowed in file name that will be saved locally.

    Default list: ['/'].

    Example: file name 'Report_2018/12/08.txt' will be replaced to 'Report_2018_12_08.txt'

Example

//Without parameters:
final path = await FlutterDocumentPicker.openDocument();
  
  ...

    
//With parameters:
FlutterDocumentPickerParams params = FlutterDocumentPickerParams(      
  allowedFileExtensions: ['mwfbak'],
  allowedUtiTypes: ['com.sidlatau.example.mwfbak'],
  allowedMimeTypes: ['application/*'],
  invalidFileNameSymbols: ['/'],
);

final path = await FlutterDocumentPicker.openDocument(params: params);

//Pick multiple files:
final paths = await FlutterDocumentPicker.openDocuments(params: params);

Categories

Source repository

Projects using this package

No data available yet.