This is more of a philosophical question, I think, and the title pretty much says it all. It seems like a contradiction, that a ListView derives from stateless, and yet can be changed while the app is running.
Asked
Active
Viewed 170 times
2 Answers
2
ListView doesn't change any value internally. It has a builder, or children, and both of them are already specified when the build method comes up.
Statefull widgets are different, they let you change the state of some variable, or in general the state of the widget itself.

Tizianoreica
- 2,142
- 3
- 28
- 43
2
The ListView
itself is not changing. You are simply rebuilding it with new information when you use a StatefulWidget
with the call setState()
. Thus the ListView
never holds or changes state, you just are creating a new ListView
with different starting information every time it changes.

Gabe
- 5,643
- 3
- 26
- 54
-
1Right, setState() triggers build(), and since I'm making my ListView in build(), it gets recreated. Got it, thank you! I am still thinking imperatively, where once you've built your UI it never changes. – Michael Rogers Jan 26 '20 at 17:13