pub repository
mirror.p-hatan.irandroid_file_picker
2.1.2Android implementation of the file_picker plugin, supporting file picking, saving, and Storage Access Framework (SAF) URI grants.
Readme
File Picker for Android
android_file_picker
The Android implementation of file_picker.
Usage
This package is endorsed, which means you can simply use file_picker as normal, and the Android implementation will be automatically included.
Android setup
If your app overrides onActivityResult in a custom MainActivity, make sure it calls super.onActivityResult(...) for activities it doesn't handle itself. Otherwise the plugin's own onActivityResult (in FilePickerDelegate) never runs, and picking a file fails silently.
initialDirectory is not supported for picking
initialDirectory currently has no effect on pickFile(), pickFiles(), pickFileAndDirectoryPaths(), or getDirectoryPath() on Android. The native side launches ACTION_OPEN_DOCUMENT, ACTION_OPEN_DOCUMENT_TREE, and ACTION_GET_CONTENT intents, none of which are given a starting location. It only works for saveFile() today.
Supporting it for picking would need turning a plain file path into a content:// document tree URI for DocumentsContract.EXTRA_INITIAL_URI, which Android's Storage Access Framework does not map to directly, so this is tracked as a future improvement rather than a quick fix.
Changelog
2.1.2
- Fixed
explorer_not_foundon Android 11+ devices that hide the documents picker from apps, such as some Xiaomi HyperOS versions. #2282 - The picker now opens directly and only reports
explorer_not_foundwhen no app can handle it, instead of asking Android first, which can miss apps hidden from the plugin.
2.1.1
- Fixed
AndroidSAFOptionsbeing ignored, so the grant, access mode and persistence they request now apply. #2257 - Picking several files now fails with
unknown_pathwhen none of them can be read, instead of returning an empty list as if the user cancelled. #2262
2.1.0
- Added
FilePickerAndroid.retrieveLostData(), to recover the files picked when Android destroys the activity while the picker is open. #1258
2.0.1
- Fixed
pickFileAndDirectoryPaths()returning percent-encoded paths that do not exist. #2225
2.0.0
- BREAKING CHANGE:
PlatformFile.length()now returnsFuture<int?>instead ofFuture<int>. Returnsnullwhen the length could not be determined (e.g. a failed disk read), instead of0, matchinglengthSync(). #2197 - Removed the native code paths behind
withData, dead since the Dart facade stopped forwarding it (file_picker12.0.0). Picked files are no longer eagerly read into memory on the platform side;PlatformFile.readAsBytes()already reads lazily on demand. #2202
1.1.1
- Fixed
saveFile()garbling the file name for extensions Android doesn't recognize, e.g. savingtrace.gpxproducedtrace.gpx.xml.gpx. #2199
1.1.0
- Implemented
PlatformFile.lengthSync(), returning the length Android already reports for a picked file synchronously.
1.0.4
-
Restored the module local
buildscriptclasspath (AGP 8.5.2, Kotlin Gradle Plugin 1.8.22) that #2154 removed. It fixedUnresolved reference compileSdk/namespace/minSdkon project configurations using AGP 9 withandroid.newDsl=falseand custom root level Gradle configuration, reported and confirmed fixed against a real affected project in #2170.This is a temporary workaround, not a permanent fix. Pinning an older AGP via a module's own
buildscriptclasspath while the consuming app applies a newer one through thepluginsblock is generally discouraged, and #2154 removed it for exactly that reason. Restoring it papers over a gap in Flutter's own AGP 9newDslmigration, which is still in progress (flutter/flutter#180137): the interim compatibility shim that letsandroid.newDsl=falseprojects use AGP 9 does not appear to reliably reach plugin modules that don't declare their own classpath, at least for some custom root level Gradle setups. Remove this block again once that migration lands upstream andandroid.newDsl=falseis no longer needed.
1.0.3
- Tightened the
file_picker_platform_interfacelower bound to^3.2.0. This package'spickFile()/pickFiles()signatures referenceDarwinOptions, added in that version, so resolving against an older one would fail to compile.
1.0.2
- Removed the stale
buildscriptclasspath from the Android module, which pinned AGP 8.5.2 and Kotlin Gradle Plugin 1.8.22 in a module that supports AGP 9 and Kotlin 2.3. #2154 - Fixed
allowedExtensionsfilters being discarded entirely and falling back to showing all files when only some of the requested extensions had no mime type known to Android (e.g.pfx,p12). Now the extensions that do resolve to a mime type are still used to filter, and*/*is only used when none of them resolve.
1.0.1
- Improved package description, added example, and added missing API documentation.
1.0.0
- Initial release of Android implementation package for
file_picker. - Removed the Apache Tika dependency (~300 KB) used for MIME type detection in
saveFile(). MIME types are now resolved from the file name extension viaMimeTypeMap, withURLConnection.guessContentTypeFromStreamas a content-sniffing fallback when no extension is available. #2101
Installing
export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add android_file_pickerpubspec.yaml
name: android_file_picker
description: Android implementation of the file_picker plugin, supporting file picking, saving, and Storage Access Framework (SAF) URI grants.
version: 2.1.2
homepage: https://github.com/vicajilau/flutter_file_picker/tree/main/packages/file_picker_android
repository: https://github.com/vicajilau/flutter_file_picker/tree/main/packages/file_picker_android
topics:
- file-picker
- android
resolution: workspace
environment:
sdk: ">=3.10.0 <4.0.0"
flutter: ">=3.38.0"
flutter:
plugin:
implements: file_picker
platforms:
android:
package: com.mr.flutter.plugin.filepicker
pluginClass: FilePickerPlugin
dartPluginClass: FilePickerAndroid
dependencies:
flutter:
sdk: flutter
file_picker_platform_interface: ^4.0.0
cross_file: ^0.3.5+4
path: ^1.9.0
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^6.0.0
Version history
| Version | Published | Archive | SHA-256 |
|---|---|---|---|
| 1.0.0 | 2026-08-14T07:22:58.662148Z | Download | 24ccc79cdc9612614703dda2d6fd6c67e8b7b16529b54ab983578488ef2d721c |
| 1.0.1 | 2026-08-15T16:46:39.395776Z | Download | 665a5a57dfca27f91a715d300e4852a784f9f98e503dcff281bec9afb55767be |
| 1.0.2 | 2026-08-25T11:01:37.277526Z | Download | 3384b62685e04ce7afeaf57e94bf29bc167e32240be6c6cb382a94632aec0241 |
| 1.0.3 | 2026-08-28T12:11:21.538170Z | Download | 1f111ed6bb33724ba782cc86357e3fd97f57051d55fc61adf33dcfc5049a1581 |
| 1.1.0 | 2026-09-02T17:14:27.986077Z | Download | 0d84bb91fb78af33756107f00cf71ee084474169d481b882b335c3006077a913 |
| 1.1.1 | 2026-09-10T04:41:18.280697Z | Download | 014c74ab48d452c3252465682375a7fe6ddf56abb908ec361f207a3c4ffb2444 |
| 2.0.0 | 2026-09-14T07:35:01.791992Z | Download | 14ab27769b54c48d5a8a71aa9858372b7a3ae77572ea0a8aee744643c5d8c53d |
| 2.0.1 | 2026-10-06T06:02:12.090897Z | Download | 537bce9a43bc6fc08670cb68498251acc6eb9134b86a391b43e1f7c863588388 |
| 2.1.0 | 2026-10-13T06:51:00.847720Z | Download | 0aac28063a1b19893f02a55dc8e2318799814881b7f920df2d12d0d043c8fbbb |
| 2.1.1 | 2026-10-15T10:33:48.285033Z | Download | e94229cc41c4bb5fb6a2254146340a8b650664c99b5c93b9001f66c3375d0060 |
| 2.1.2 | 2026-10-25T16:20:19.182636Z | Download | 03d3dd3cb578ab26b1e528aeea27bf6b976942f5a24e3da82d270369b8e161a8 |
Dependencies
cross_file "^0.3.5+4"
file_picker_platform_interface "^4.0.0"
flutter {
"sdk": "flutter"
}
path "^1.9.0"