Skip to content

[file_selector_android] Expose DISPLAY_NAME of the files selected using openFile #131328

Open

Description

@jjanku

Is there an existing issue for this?

Use case

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.

Activity

  1. dam-ease commented on Jul 26, 2023

    @dam-ease

    Hi @jjanku. Thanks for filing this. This seems to be similar to #113441. Can you confirm it is?

  2. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Jul 26, 2023
  3. jjanku commented on Jul 26, 2023

    @jjanku
    Author

    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.

  4. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Jul 26, 2023
  5. stuartmorgan-g commented on Jul 26, 2023

    @stuartmorgan-g
    Contributor

    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.

  6. added
    platform-androidAndroid applications specifically
    packageflutter/packages repository. See also p: labels.
    P2Important issues not at the top of the work list
    fyi-androidFor the attention of Android platform team
    and removed
    in triagePresently being triaged by the triage team
    on Jul 26, 2023
  7. stuartmorgan-g commented on Jul 26, 2023

    @stuartmorgan-g
    Contributor

    (fyi-android just for awareness; the fix here would be a trivial Dart-only change once XFile supports alternate implementations.)

  8. smiera commented on Aug 15, 2023

    @smiera
  9. iamjay commented on Oct 22, 2023

    @iamjay

    As a workaround, I override cross_file package with this fix iamjay/packages@4f472f5

  10. vaib9560 commented on Nov 2, 2023

    @vaib9560
  11. vaib9560 commented on Nov 3, 2023

    @vaib9560
  12. Liloupar commented on Dec 26, 2023

    @Liloupar

    @iamjay Could you create a PR for this? I really need this solution as well, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listp: file_selectorThe file_selector pluginpackageflutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyteam-ecosystemOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions