flutter_cached_network_image icon indicating copy to clipboard operation
flutter_cached_network_image copied to clipboard

Image request not being cancelled when item is disposed

Open dovahkiin98 opened this issue 4 years ago • 4 comments

I have a ListView with, say, 400 items. Each item has it's own Image

If I scroll past 100 items (without stopping), then come back to them, these 100 items would have their images downloaded, meaning even when the item was no longer visible, the image request was not cancelled.

There is no callback to recycle an item inside the ListView, and I know it's automatic. But does CachedNetworkImage not cancel it's request when it's been disposed?

dovahkiin98 avatar Oct 21 '21 09:10 dovahkiin98

At the moment we don't cancel requests indeed.

renefloor avatar Oct 27 '21 06:10 renefloor

This consumes a lot of network bandwidth

baneyue avatar Oct 29 '21 05:10 baneyue

Is there a way to wrap the widget in a State and cancel the request in dispose?

dovahkiin98 avatar Feb 01 '22 19:02 dovahkiin98

After many tests with my app, the app crashes sometimes when scrolling through the list. The list is a grid of items, all of them having an image. And when the scroll is just a little fast, the application starts trying to load all the images, and eventually crashes in some cases

dovahkiin98 avatar May 27 '22 13:05 dovahkiin98

exposed A CancelToken let user controller @renefloor

lwj1994 avatar Apr 17 '23 06:04 lwj1994