To build an optimized ListView with its builder constructor, you need to tell Flutter how large the list is via the itemCount property. If you don't include it, Flutter will think that the list is infinitely long and it will never terminate. There may be a few cases where you want to use an infinite list, but they are rare. In most cases, you need to tell Flutter how long the list is; otherwise, you will get an "out of bounds" error.
The secret to scrolling performance is found in the itemBuilder closure. In the previous recipe, you added a list of known children to ListView. This forces Flutter to create and maintain the entire list of widgets. Widgets themselves are not that expensive, but the Elements and RenderObjects properties that sit underneath the widgets inside Flutter's internals are.
itemBuilder solves this problem by enabling deferred rendering. We are no longer providing...