If you set headers on your ExtendedNetworkImageProvider, it will not be considered equal on a rebuild, even if the header values are the same. This is because the operator == will compare the identity of the map, not the values. So the widget will think it's a new image, and load from scratch. The only workaround now is you need to create the header map and store it elsewhere, or else your image will rebuild/reload a lot.
In _network_image_io.dart
bool operator ==
, I think it will be useful to do some deep comparison of headers
and other.headers
. Since we know it's HTTP headers, it won't be a multi-level map, so mapEquals
in package:flutter/foundation.dart
could be used.
Without fixing this, once you use headers in your extended image, the performance goes down a lot. It was not obvious to see why, it could be good to fix it so other don't have the problem.