As title I want to know about cacheExtent and what it's doing. It takes double values; I tried to make it equal to 999999999999999 and then I noticed a huge improvement in ListView.Builder scrolling performance, so I need to know about it.
ListView. builder is a way of constructing the list where children's (Widgets) are built on demand. However, instead of returning a static widget, it calls a function which can be called multiple times (based on itemCount ) and it's possible to return different widget at each call.
In contrast to the default ListView constructor, which requires creating all items at once, the ListView. builder() constructor creates items as they're scrolled onto the screen.
According to the documentation :
cacheExtent
is the size of the area that is drawn before being in the visible part of the screen, it has two parts : the one before the visible area where items are already displayed, and the other after the visible area.
When you made the size of cacheExtent
very huge (999999999999999) you almost made your ListView
draw all its children before and after the currently displayed items, that's way the "lagging" behavior disappeared. But you have to use the cache wisely, because making it very big will result in unpleasant side effects, like significant increase in internet traffic for your users. Lazy loading is there for a reason.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With