I am displaying a list of images inside a GridView in my Flutter app using Image.network(url).
The issue: when scrolling through the grid, NetworkImage seems to open a new TCP connection for each image request instead of reusing an existing one. This causes high network usage and puts a heavy load on the phone.
My code:
`GridView.builder(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,
),
itemCount: imageUrls.length,
itemBuilder: (context, index) {
return Image.network(imageUrls[index]);
},
);
`
Flutter would reuse existing TCP connections for multiple images from the same domain.
Once an image is downloaded, it would be retrieved from cache (memory or disk) instead of opening a new network connection.