Home > Net >  Optimizing for ListView and Column?
Optimizing for ListView and Column?

Time:11-20

There is a Sentence in flutter docs about performance that says

Avoid using constructors with a concrete List of children (such as Column() or ListView()) if most of the children are not visible on screen to avoid the build cost.

link

is there any one who understand what it really means or can explain it with an example?

CodePudding user response:

ListView.builder() allows us to create children dynamically as the user scrolls, contrary to ListView and Column that, instead, create all the children in one go.

This optimization gains importance as we deal with long lists of children: we don't need to render items that are not in the view, therefore ListView.builder() comes in very handy by creating the widgets on demand.

You can dig into the implementation of the builder() constructor of ListView in the official documentation, or read more about this practice for dealing with long lists in the Flutter cookbook.

  • Related