-
Notifications
You must be signed in to change notification settings - Fork 28.6k
camera plugin - saveTo() completes before file lock is released sometimes #72652
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
Comments
Hi @darre1 |
@darre1 the I understand that this is not really clear to users of the |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
Hi
The latest release of the camera plugin (0.6.0) has started using an XFile. the
saveTo()
function seems to have a problem though where the lock on the file is not always being released before the function completes or something.For example I was doing this:
...and then attempting to display the file on-screen immediately afterwards (like this:
Image.file(File(path))
. 2 times out of 3 it would work fine but sometimes I would get an error that the file could not be found. If I browse through the phone itself though I will find that the file does exist and I was using the correct path in code (I double-checked everything!).To get around the problem I am now doing this:
The above approach doesn't suffer from the same problem, presumably because the Future is not returned by
writeAsBytes()
until the exclusive lock it has on the file (i.e. while writing to it) has been released.The text was updated successfully, but these errors were encountered: