Home > Net >  Does the Column build its children lazily in flutter?
Does the Column build its children lazily in flutter?

Time:11-07

Column can also have listview.builder, if the column builds all of its children at a time, does it build listview items at once too?

CodePudding user response:

Column builds all of its children at once, but listview.builder builds lazily.

when you pass childrens: to ListView, it builds all at once. Only difference is Column shows all of its childrens in the screen while ListView has scroll functionality.

CodePudding user response:

ListView takes a specific space of screen with 2 constraints on that top space & bottom space.

============ (top constraint/pixel)
||||
||||
<This is the space of you ListView>
||||
||||
============ (bottom constraint/pixel)

If you scroll up, it will detect that items have been scrolled through pixel constraints and lazy load the next items. So if your parent widget is whatever Container, Row, Column, it will always be able to lazy loading. And that is the main difference between Column & ListView.builder, Column build everything in 1 time, and ListView.builder can use lazy loading.

  • Related