Repository navigation
Add debugNetworkImageHttpClientProvider - #32857
Conversation
Currently, the fact that NetworkImage uses a static HttpClient makes it impossible to properly test, as a mock in one test will be reused in another test. This change fixes that. #32374
|
This change depends on #32853, since otherwise we'd receive compressed bytes after consolidation. |
|
@tvolkert Is there a chance to extend this provide a specific In our testing we have a "record" mode (with With the approach introduces here, we'd still have to write a rather smart HTTP client mock that in recording mode returns fallback images for some requests (from |
|
@tp yep that makes sense. I'll update this PR shortly. |
|
You can provide a specific HttpClient using |
|
@jonahwilliams yes, but allowing debug builds direct access to the creation of the client does simplify things a lot (including the tests). |
You could add a test to verify that |
Description
Currently, the fact that NetworkImage uses a static HttpClient
makes it impossible to properly test, as a mock in one test will
be reused in another test. This change fixes that.
Related Issues
#32374
Tests
This change is about preparing for tests that will land in a follow-on
PR - existing tests were restructured in this PR, but no new tests were added
(yet).
Checklist
///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change