ListView in Flutter: Types, Performance & Best Practices
ListView is the workhorse of Flutter layouts, yet many developers default to ListView(children: [...]) and then wonder why long lists stutter. The widget family actually offers four constructors, each with a distinct performance profile and ideal use case.
This guide breaks down every ListView type, from the eager default to the lazy builder and separated variants, and explains when to use each. You'll also get concrete numbers on item counts, memory ranges, and scrolling behavior so you can pick the right list for your next screen.
The Four ListView Constructors at a Glance
Flutter provides ListView(), ListView.builder(), ListView.separated(), and ListView.custom(). The default constructor builds all children upfront, which is fine for a handful of items but quickly becomes expensive. The builder and separated constructors create items lazily as they scroll into view, keeping memory and build time proportional to what's visible rather than the total item count.
ListView.custom gives you full control by accepting a SliverChildDelegate. This is the escape hatch for irregular lists, such as those backed by a pre-built list of widgets or a custom findChildIndexCallback for reordering. Most apps will never need it, but it's worth knowing it exists when the standard lazy builders don't fit.
- ListView() – eager, builds all children immediately
- ListView.builder() – lazy, builds items on demand
- ListView.separated() – lazy with automatic separators
- ListView.custom() – full control via SliverChildDelegate
When to Use ListView() vs ListView.builder()
Use the default ListView() only when you have a fixed, small number of children—think under 20 items that all fit on screen or nearly so. Because it constructs every child widget in the build method, the cost grows linearly with item count. For a settings screen with 8 rows, that's negligible; for a chat history of 500 messages, it's a jank factory.
ListView.builder() shines for dynamic or long lists. It calls itemBuilder only for indices that are visible (plus a small cache extent), so a list of 10,000 items builds perhaps 15–30 widgets at a time. The typical visible-plus-cache window on a phone is around 10–20 items, depending on item height and device pixel ratio. That keeps frame times well under the 16 ms budget for 60 fps.
| Constructor | Build strategy | Best for | Memory impact | Typical item range |
|---|---|---|---|---|
| ListView() | Eager | Short static lists | High for long lists | Under 20 |
| ListView.builder() | Lazy | Long or dynamic lists | Low | 20 to 10,000+ |
| ListView.separated() | Lazy + separators | Lists with dividers | Low | 20 to 5,000 |
| ListView.custom() | Custom delegate | Special recycling needs | Varies | Any |
| Nested ListView (shrinkWrap) | Eager | Small inner lists | High | Under 10 |
ListView.separated: Dividers Without the Overhead
ListView.separated() works like the builder but inserts a separator between items via the separatorBuilder. It's the cleanest way to add dividers, spacing, or custom widgets between rows without manually padding each item. The separatorBuilder is called for each gap, so keep it lightweight—a simple Divider or SizedBox is ideal.
A common mistake is using a heavy widget as a separator, such as a full-width Container with decoration. That doubles the number of widgets built per visible item and can measurably increase scroll jank on low-end devices. Prefer const widgets and avoid rebuilding separators unnecessarily.
- Separator is built lazily alongside items
- Keep separatorBuilder cheap—use const where possible
- Great for chat bubbles, settings rows, and feeds
- Avoid heavy decorations in separators to reduce jank
ListView.custom and SliverChildDelegate
ListView.custom is the most flexible constructor because it accepts a SliverChildDelegate, which controls how children are built and found. The most common delegate is SliverChildBuilderDelegate, which is what ListView.builder uses under the hood. You'd reach for custom when you need a delegate that reuses widgets, implements findChildIndexCallback for reorderable lists, or wraps an existing delegate with extra logic.
For example, if you have a list of pre-built widgets that you want to recycle, SliverChildListDelegate can wrap them. But beware: that delegate still builds all children, so it's not a performance win for long lists. Use custom only when the built-in constructors genuinely can't express your layout.
Performance: Item Extent, Prototype Item, and Keys
Two properties can dramatically improve scroll performance: itemExtent and prototypeItem. If all items have the same height, setting itemExtent lets Flutter skip layout calculations for off-screen items, reducing jank. If heights vary but you can provide a representative prototype, prototypeItem achieves a similar effect by measuring once.
Keys matter when list items are stateful or reorderable. Without keys, Flutter may recycle state incorrectly when the list changes. Use ValueKey(item.id) on each item, especially in ListView.builder, to preserve state and avoid subtle bugs. Also avoid expensive work inside itemBuilder—keep builds pure and fast.
- Set itemExtent for uniform-height lists
- Use prototypeItem when heights vary but are predictable
- Always key stateful items with a stable ID
- Keep itemBuilder free of heavy computation
Nested Lists and Common Pitfalls
Placing a ListView inside another scrollable (like a Column with a SingleChildScrollView) causes unbounded height errors. The fix is to give the inner ListView a bounded height (SizedBox) or set shrinkWrap: true. But shrinkWrap forces the list to build all children to measure itself, defeating laziness—avoid it for long lists.
For complex screens with multiple scrolling sections, prefer CustomScrollView with slivers. It lets you mix SliverList, SliverGrid, and SliverAppBar without nesting scrollables. If you're coming from a fragment-based Android background, the mental model is similar to Jetpack Navigation vs Manual Fragment Transactions—each approach has trade-offs in structure and performance.
Key points
- Use ListView.builder() for any list longer than ~20 items; it builds only visible items.
- ListView.separated() adds dividers lazily—keep separators lightweight.
- Set itemExtent or prototypeItem to improve scroll performance.
- Avoid shrinkWrap on long lists; use CustomScrollView with slivers instead.
Flutter Screen Widget and Cost Estimator
Estimate the number of widgets in a screen and a rough development-hour figure from your component counts. Adjust the fields to see how each UI area affects the total effort.
Editor and Flutter contributor
Writes practical Flutter tutorials focused on widgets, layout and animation. Enjoys breaking large UI problems into small, testable pieces and explaining them clearly to beginners.