Mobile development

Stage 2 · Lesson 7 of 10

ListView.builder, GridView and images

Widgets and layout

ListView(children: [...]) builds every child at once. That is fine for a settings page of ten and slow for a feed of a thousand. ListView.builder and GridView.builder are : they build rows only as they scroll into view, using an itemBuilder and an itemCount.

Use ListView.separated when you want dividers. Give rows a ValueKey based on the item id when items can move. For images, Image.network works but does not keep a cache between app launches, so many apps use the cached_network_image package. Setting cacheWidth or cacheHeight decodes large photos at the size they are shown.

Common trapa Column of hundreds of inside a SingleChildScrollView, which builds everything up front.

A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock

Resources for this stage

Start with

  • GuideFree
    Flutter Documentation

    Google

    Do the first Flutter app codelab, then the layout, constraints and lists pages

Practise

  • Use a free challenge's mobile design image as the spec for a native screen

Keep handy

Mark this stage as not done?