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.
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.
UIDocumentPickerViewController is used. Files can be filtered by list of UTI types using
allowedUtiTypes parameter. Picked file path is returned as result.
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.
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.
allowedMimeType(used only in Android)
Only files with provided MIME type will be shown in document picker. If param is null -
*/*MIME type will be used.
//Without parameters: final path = await FlutterDocumentPicker.openDocument(); ... //With parameters: FlutterDocumentPickerParams params = FlutterDocumentPickerParams( allowedFileExtensions: ['mwfbak'], allowedUtiTypes: ['com.sidlatau.example.mwfbak'], allowedMimeType: 'application/*', ); final path = await FlutterDocumentPicker.openDocument(params: params);
For help getting started with Flutter, view our online documentation.
For help on editing plugin code, view the documentation.