You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[file_selector_android] Expose DISPLAY_NAME of the files selected using openFile #131328
I would like to display the name of the file that was selected by the user through the openFile function provided by the file_selector package. However, on Android, the name returned by (await openFile(...))?.name has no obvious relationship to the name the user saw in the selection dialog.
I briefly searched through the code of the Android implementation --- the name that should be returned is retrieved, but then it is dropped by XFile. The last path segment is returned instead.
(I encountered this issue when trying to migrate from file_picker to file_selector.)
Proposal
I believe that XFile.name should be decoupled from XFile.path on Android (similarly to web).
Any other way to retrieve the DISPLAY_NAME of the selected files would be appreciated too.
Reacted by Oleksandr Smyrnov, MadhuN, Zetra, zthrive and Liloupar
Hi, this is quite a different request. My issue concerns opening an existing file and retrieving its name, #113441 seems to deal with obtaining a path where a new file can be saved. My issue should be imho much easier to fix since the necessary pieces are already there, see the links.
This is likely blocked on #91869, since the ideal way to handle this would be an Android-specific XFile implementation, which would require making it an interface.
Activity
dam-ease commentedon Jul 26, 2023
Hi @jjanku. Thanks for filing this. This seems to be similar to #113441. Can you confirm it is?
jjanku commentedon Jul 26, 2023
Hi, this is quite a different request. My issue concerns opening an existing file and retrieving its name, #113441 seems to deal with obtaining a path where a new file can be saved. My issue should be imho much easier to fix since the necessary pieces are already there, see the links.
stuartmorgan-g commentedon Jul 26, 2023
This is likely blocked on #91869, since the ideal way to handle this would be an Android-specific
XFileimplementation, which would require making it an interface.stuartmorgan-g commentedon Jul 26, 2023
(fyi-android just for awareness; the fix here would be a trivial Dart-only change once
XFilesupports alternate implementations.)smiera commentedon Aug 15, 2023
iamjay commentedon Oct 22, 2023
As a workaround, I override cross_file package with this fix iamjay/packages@4f472f5
vaib9560 commentedon Nov 2, 2023
vaib9560 commentedon Nov 3, 2023
Liloupar commentedon Dec 26, 2023
@iamjay Could you create a PR for this? I really need this solution as well, thanks.