Repository navigation
fix(web): report cached file read and decode failures on HttpGet - #1063
Merged
Merged
Conversation
rickdijk
reviewed
Oct 27, 2026
rickdijk
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for this, turning the uncaught read/decode error into a stream error is a clear improvement. A few things in the new close/cleanup logic, mostly around the case where getFileStream emits more than one FileInfo (stale cached copy followed by a fresh download), plus the download-error path.
A failure while reading or decoding a cached file was never delivered to the image stream. Report it, evict the image, remove the broken cache entry and close the streams. Also close the streams when every decode finished before the download completed.
akashchamp
force-pushed
the
fix/web-httpget-decode-errors
branch
from
October 27, 2026 10:57
ac2a00f to
b0f4ece
Compare
rickdijk
reviewed
Oct 28, 2026
rickdijk
approved these changes
Oct 29, 2026
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
✨ What kind of change does this PR introduce? (Bug fix, feature, docs update...)
Bug fix
With
ImageRenderMethodForWeb.HttpGet, a failure to read or decode a cached file is an uncaught error. It never reaches the image stream, so the error widget and error listener are not called, the image is not evicted, the broken file stays in the cache and the streams are never closed. The placeholder stays forever.🆕 What is the new behavior (if this is a feature change)?
A read or decode failure is added to the image stream, the broken cache entry is removed so the next attempt downloads again, the image is evicted once the entry is gone, and both controllers are closed. A stale cached file that fails to decode is only a failure if no fresh file follows; a failure after a frame was shown keeps that frame and does not touch the cache. A download error now closes the streams too. The streams are also closed when every decode finished before the download completed. Only the web loader removes the broken cache entry; the IO loader is unchanged.
💥 Does this PR introduce a breaking change?
No
🐛 Recommendations for testing
Added tests to
cached_network_image_web(decode failure with and without a cache key, a failingremoveFile, a stale file followed by a fresh one, both failing, a failure after a decoded frame, download errors, and the success path). They wait on the image stream'sonDoneinstead of a fixed delay. Incached_network_image_web:flutter testandflutter test --platform chromepass,flutter analyzeis clean, and the files are formatted. The new failure tests fail without the fix.📝 Links to relevant issues/docs
Fixes #1060
🤔 Checklist before submitting