Scope 13.0.0: nullable PlatformFile.length() and removal of parameters deprecated since 12.0.0 - #2203
Merged
vicajilau merged 3 commits intoSep 11, 2026
Conversation
…eprecated since 12.0.0 Implements the plan agreed in #2202. PlatformFile.length() now returns Future<int?> across the interface and all five platform implementations, using null to mean the length could not be determined, distinct from a genuinely empty file which still returns 0. Fixes #2197. Removed the parameters deprecated since the 12.0.0 federated rewrite: allowMultiple, withData, withReadStream, readSequential, lockParentWindow, cancelUploadOnWindowBlur, and androidSafOptions on FilePicker's pickFiles(), pickFile(), getDirectoryPath(), and saveFile(). Bumped file_picker to 13.0.0, file_picker_platform_interface to 4.0.0, and android_file_picker, file_picker_darwin, file_picker_linux, windows_file_picker to 2.0.0 and file_picker_web to 4.0.0, updated the example app and tests, and added a Migrating to v13 section to the README.
This was referenced Sep 10, 2026
…-nullable-and-deprecated-cleanup # Conflicts: # example/lib/src/file_picker_demo.dart # packages/file_picker/CHANGELOG.md # packages/file_picker/pubspec.yaml # packages/file_picker_darwin/CHANGELOG.md # packages/file_picker_darwin/pubspec.yaml # packages/file_picker_platform_interface/CHANGELOG.md # packages/file_picker_platform_interface/pubspec.yaml # packages/file_picker_windows/CHANGELOG.md # packages/file_picker_windows/pubspec.yaml
Owner
Author
|
Everyting ready for your review @navaronbracke 🚀 |
navaronbracke
approved these changes
Sep 11, 2026
| withData: _withData, | ||
| androidSafOptions: _androidSafOptionsFromFlags(), | ||
| androidOptions: | ||
| _androidSafOptionsFromFlags() ?? const AndroidOptions(), |
Collaborator
There was a problem hiding this comment.
Could _androidSafOptionsFromFlags() default to returning const AndroidOptions() as fallback, so it is a non null result? That would avoid some repetition
Collaborator
|
@vicajilau Once this is merged, we can start removing the deprecated options in native code in cleanup pull requests 🚀 |
vicajilau
deleted the
feat/scope-v13-length-nullable-and-deprecated-cleanup
branch
September 11, 2026 07:35
vicajilau
added a commit
that referenced
this pull request
Sep 11, 2026
Follow-up cleanup suggested in #2203, after that PR removed the deprecated withData facade parameter that used to control this. The Dart plugin for Android and iOS has not sent a withData argument over the method channel since the 12.0.0 federated rewrite, so loadDataToMemory was permanently pinned to false on both platforms already, no picked file was ever eagerly read into memory. Removed the parameter threading through FilePickerPlugin.kt, FilePickerDelegate.kt, FileUtils.kt on Android and IOSFilePickerHandler.swift on iOS, along with the now unreachable eager read branches, the loadData() helper, and the bytes wire key it populated (also dropped from FileInfo.toMap() and the corresponding Dart fromMap() parsing). PlatformFile.readAsBytes() already reads lazily on demand and is unaffected. Verified with flutter build apk, flutter build macos, and flutter build ios --simulator, plus analyze/test/format across the workspace.
vicajilau
added a commit
that referenced
this pull request
Sep 11, 2026
Follow-up cleanup suggested in #2203, after that PR removed the deprecated withData facade parameter that used to control this. The Dart plugin for Android and iOS has not sent a withData argument over the method channel since the 12.0.0 federated rewrite, so loadDataToMemory was permanently pinned to false on both platforms already, no picked file was ever eagerly read into memory. Removed the parameter threading through FilePickerPlugin.kt, FilePickerDelegate.kt, FileUtils.kt on Android and IOSFilePickerHandler.swift on iOS, along with the now unreachable eager read branches, the loadData() helper, and the bytes wire key it populated (also dropped from FileInfo.toMap() and the corresponding Dart fromMap() parsing). PlatformFile.readAsBytes() already reads lazily on demand and is unaffected. Verified with flutter build apk, flutter build macos, and flutter build ios --simulator, plus analyze/test/format across the workspace.
6 tasks
Owner
Author
Yes!! #2205 is ready |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the scope agreed in #2202.
PlatformFile.length() becomes Future<int?>
Fixes #2197.
length()returned0both for a genuinely empty file and for a failed lookup, with no way to tell them apart. It now returnsnullin the failure case, matchinglengthSync(), across the platform interface and all five platform implementations (Android, Darwin, Linux, Web, Windows).Removal of parameters deprecated since 12.0.0
Removed from
FilePicker.pickFiles()/pickFile()/getDirectoryPath()/saveFile():allowMultiple,withData,withReadStream,readSequentiallockParentWindow(the top level one, notWindowsOptions.lockParentWindow/LinuxOptions.lockParentWindow)cancelUploadOnWindowBlurandroidSafOptionsNone of these were ever forwarded to the platform implementations except
androidSafOptions, which is now folded intoandroidOptionsdirectly (matching what the deprecation message already pointed callers to).Versioning
file_picker_platform_interface: 3.3.0 to 4.0.0android_file_picker,file_picker_darwin,file_picker_linux,windows_file_picker: to 2.0.0file_picker_web: 3.1.0 to 4.0.0file_picker: 12.2.0 to 13.0.0Also updated the example app and its tests, and added a "Migrating to v13" section to the README.
Test plan
melos exec -- flutter analyze .clean across all 8 packagesmelos exec -- flutter testall green across all 8 packagesdart format --output=none --set-exit-if-changed .clean