Skip to content

Support for saving files at selected location on Android and iOS in the file_selector plugin #168318

Open

Description

@ekuleshov

Use case

Currently the file_selector plugin declares saving files at selected location on Android and iOS as unsupported (or not implemented). It would be great if if this functionality worked on all platforms.

Proposal

The current cross_file API allows to specify either the path or the data for files.

When path is provided we can toss a temp file and send the path over the plugin channel and then use corresponding platform API on Android and iOS to select file location for saving. That should also allow to send through very large files on mobile platforms and that use case is not well supported in the ecosystem.

I can try to put together a PR if this proposed feature makes sense.

Activity

  1. darshankawar commented on May 6, 2025

    @darshankawar
    Member

    @ekuleshov
    I think there's already respective open issues for the use case, please check if they resemble yours or not:

    #113441
    #111583

  2. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on May 6, 2025
  3. ekuleshov commented on May 6, 2025

    @ekuleshov
    Author

    @darshankawar after reviewing these issues neither of them describe or exactly targeting the scenario I'd like to address.

    These issues are discussing supporting some native UI for selecting a file path (or a folder) for saving a file and current API returns a path to that location.

    Unfortunately on mobile platform that path is not enough for saving a file. For example, on Android the file/document API returns a content://... url backed up by available content provides and there is native Android API to save/read a stream to/from that content url. And native framework handles all appropriate permissions.

    Perhaps either a new API method (e.g. saveFile) needs to be added to the file_selector plugin, or XFile parameter added to getSaveLocation(). Then XFile would contain either data or a path to file that needs to be saved. Then plugin can show a platform-specific UI to select file location and name and then would save XFile content there using native API.

  4. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on May 6, 2025
  5. darshankawar commented on May 7, 2025

    @darshankawar
    Member

    Thanks for the feedback.

  6. added
    packageflutter/packages repository. See also p: labels.
    c: proposalA detailed proposal for a change to Flutter
    and removed
    in triagePresently being triaged by the triage team
    on May 7, 2025
  7. stuartmorgan-g commented on May 13, 2025

    @stuartmorgan-g
    Contributor

    Unfortunately on mobile platform that path is not enough for saving a file. For example, on Android the file/document API returns a content://... url backed up by available content provides and there is native Android API to save/read a stream to/from that content url.

    Could you link to the specific APIs you are proposing wrapping, to make it clear how this would map to underlying system functionality?

    (If the only way to implement file saving is with a different API, we should probably updating the existing issues accordingly, rather than having two versions of the request, one of which is not implementable.)

  8. added
    P2Important issues not at the top of the work list
    on Jun 3, 2025
  9. stuartmorgan-g commented on Jun 3, 2025

    @stuartmorgan-g
    Contributor

    (Triaging for now, but we should re-evaluate later whether this should be a duplicate.)

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 listc: proposalA detailed proposal for a change to Flutterp: file_selectorThe file_selector pluginpackageflutter/packages repository. See also p: labels.team-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