Forward initialDirectory and dialogTitle to native on Darwin - #2218
Conversation
pickFile(), pickFiles(), and getDirectoryPath() accepted initialDirectory as a parameter but never included it in the method channel arguments, so it never reached the native macOS and iOS implementations, which already read it correctly. getDirectoryPath() sent no arguments at all, so dialogTitle was dropped too. Fixes #2216
navaronbracke
left a comment
There was a problem hiding this comment.
LGTM, although I would also cross check Windows / Linux / Android
Co-authored-by: Navaron Bracke <brackenavaron@gmail.com>
Co-authored-by: Navaron Bracke <brackenavaron@gmail.com>
|
Good call @navaronbracke!! I checked all three. Windows and Linux are fine end to end. Android has the same Dart side gap this PR fixes for Darwin ( |
The native side never sets DocumentsContract.EXTRA_INITIAL_URI for ACTION_OPEN_DOCUMENT, ACTION_OPEN_DOCUMENT_TREE, or ACTION_GET_CONTENT, only saveFile honors initialDirectory today. Making it work for picking needs native support to turn a plain path into a SAF document tree URI, tracked as a future improvement rather than fixed here.
Summary
pickFile(),pickFiles(), andgetDirectoryPath()infile_picker_darwinacceptedinitialDirectory(anddialogTitleforgetDirectoryPath()) but never included them in the method channel arguments map, so they never reached native code.args["initialDirectory"]/args["dialogTitle"]correctly in all four of its handlers, it was simply never receiving them.pickFile(),pickFiles(), andgetDirectoryPath().file_picker_darwinto 2.1.2 (patch, bug fix) with a changelog entry.Fixes #2216
Test plan
flutter test test/file_picker_darwin_test.dart(12/12 passing, including the 2 new tests)dart analyze lib test(no issues)dart formatapplied