Skip to content

saveFile always return the download path on Android #1636

@hioshih

Description

@hioshih

Describe the bug
Reopening report 1590.
As stated, saveFileDialog returns a file path pointing to the download folder regardless of the directory picked by the user.

Workaround
A workaround is to send the file data directly through bytes, but if you intended to check on the saved file afterwards you will fail to do so.
But then, this will become incompatible with Desktop, because on windows it does return the correct folder but doesn't save the bytes contents automatically.

Platform

  • Android
  • iOS
  • Web
  • Desktop

How are you picking?

var fileName;
    String data = 'this is the\n text file content';
    final bytes = Uint8List.fromList(data.codeUnits);
    //picks a folder and filename to save
    fileName = await FilePicker.platform.saveFile(
      bytes: bytes,
    );
    //saves in the correct folder but enforces returning string as the download folder
    print('saveFile returned file: $fileName');

file saved in "/storage/emulated/0/myfolder/saved.txt"
output: "saveFile returned file:: /storage/emulated/0/Download/saved.txt"

Details to reproduce the issue
Brand new blank flutter project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    new issueAn issue that hasn't yet been seen from the maintainerstale

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions