Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

saveFile always return the download path on Android #1636

Open
1 of 4 tasks
hioshih opened this issue Nov 23, 2024 · 5 comments
Open
1 of 4 tasks

saveFile always return the download path on Android #1636

hioshih opened this issue Nov 23, 2024 · 5 comments
Labels
new issue An issue that hasn't yet been seen from the maintainer

Comments

@hioshih
Copy link

hioshih commented Nov 23, 2024

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.

@hioshih hioshih added the new issue An issue that hasn't yet been seen from the maintainer label Nov 23, 2024
Copy link

github-actions bot commented Dec 1, 2024

This issue is stale because it has been open for 7 days with no activity.

@github-actions github-actions bot added the stale label Dec 1, 2024
@hioshih
Copy link
Author

hioshih commented Dec 1, 2024

up

@hioshih
Copy link
Author

hioshih commented Dec 1, 2024

This issue is stale because it has been open for 7 days with no activity.

This bot is just closing all the issues aggressively (7 days) without solving anything and neither giving a chance for people to deal with them. 😢

@github-actions github-actions bot removed the stale label Dec 2, 2024
@alexaungmyooo
Copy link

May I know how do you solve this issue?

@hioshih
Copy link
Author

hioshih commented Dec 8, 2024

May I know how do you solve this issue?

I didn't.

It would either give an exception, or I could send the file contents using the bytes which is a shady undocumented parameter. But even so, it wouldn't return the correct folder where the file was saved.

Tried to look into the code but it seemed very complex with almost no comments, so I couldn't figure out yet why it stopped working, even though I'm almost sure it wasn't like this in the past. My guess is that some recent updates broke this feature on android.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new issue An issue that hasn't yet been seen from the maintainer
Projects
None yet
Development

No branches or pull requests

2 participants