[Android:Fix] Fix an issue where saveFile would return an incorrect path #1712
[Android:Fix] Fix an issue where saveFile would return an incorrect path #1712Dogbonee wants to merge 4 commits intomiguelpruivo:masterfrom
saveFile would return an incorrect path #1712Conversation
|
@Dogbonee Do you have some before/after samples to verify your fix? |
|
I used the unmodified base example to test my fix (with the added bytes argument in As a side note, the merge that you committed changed the bytes argument in the example from |
Hmm, that error probably has to do with a recent change for |
|
@vicajilau With the recent Kotlin migration, can you look into porting this fix into the new Kotlin sources? |
|
@navaronbracke this has been resolved as you comment. I attach evidence: |
|
@vicajilau The returned path is probably not valid for the dart:io File API, and only works with Android's ContentResolver API? (due to the |
|
@navaronbracke Android does not expose the actual file path behind a |
|
@navaronbracke After analysis, the conclusion is that there are 3 options to solve this.
The disadvantage of working with or returning the temporary path is that we do not control or decide how long Android will decide that the file exists. For that reason, I think the API should aim to ensure that the |

Currently
saveFilealways returns a path to downloads with the filename appended on the end. This doesn't seem like intended behavior, but the path seemed to be hardcoded to the downloads directory environment variable. This PR just changes the path to the activity's uri real path. Also fixed a minor issue in the example where thebytesargument was required to save, but was not included in the example.Related to issue #1636