How to Display a Dynamic List of Items Using ListTile in Flutter Without Performance Issues

Use ListView.builder or ListView.separated to lazily render only visible items, specify itemExtent for fixed-height tiles to skip expensive layout calculations, and provide stable Key objects to minimize unnecessary rebuilds.

Displaying a dynamic list of items using ListTile in Flutter requires careful attention to performance when dealing with large datasets. The flutter/flutter repository provides specialized constructors that implement lazy loading and widget recycling to maintain smooth 60fps scrolling. Understanding the underlying implementation in the source code allows you to optimize memory usage and build responsive user interfaces.

Use ListView.builder for Lazy Loading

The default ListView constructor builds every child widget upfront, causing severe memory pressure and slow initial render times with large datasets. According to the Flutter source code in packages/flutter/lib/src/widgets/scroll_view.dart, the ListView.builder constructor (defined at line 891) creates a SliverChildBuilderDelegate that only calls the supplied itemBuilder for indexes currently visible in the viewport.

This lazy-building approach recycles ListTile widgets as the user scrolls, dramatically reducing build-time work and memory consumption. The framework automatically handles viewport calculations and widget lifecycle management without loading off-screen items into memory.

Optimize ListTile Construction

ListTile is a relatively heavy widget because it manages tap ink splashes, accessibility semantics, and optional leading or trailing widgets. To maintain performance when displaying dynamic lists:

  • Mark immutable tiles as const when content does not depend on runtime data, allowing the Dart compiler to share widget instances.
  • Avoid expensive work inside itemBuilder such as network calls or heavy computations; perform these operations outside the builder and pass results as data.
  • Provide a stable Key using ValueKey or ObjectKey for each tile when the list can reorder or change size, allowing Flutter to preserve state and avoid rebuilding the entire list.
  • Prefer simple Text widgets for title and subtitle; if you need rich formatting, use RichText directly to avoid extra layout passes that ListTile performs internally.

Specify itemExtent to Eliminate Layout Passes

When every list item has the same height, set the itemExtent parameter on ListView. According to packages/flutter/lib/src/widgets/scroll_view.dart (line 1515), this optimization allows the scrolling engine to calculate scroll offsets without measuring each child, reducing layout complexity from O(n) to O(1).

For lists with varying heights, use itemExtentBuilder to provide size hints, allowing the sliver to perform partial layout optimizations while still supporting dynamic content sizes.

Use ListView.separated for Dividers

When displaying a dynamic list of items using ListTile with dividers, use ListView.separated instead of manually adding dividers inside itemBuilder. As implemented in packages/flutter/lib/src/widgets/scroll_view.dart at line 1501, this constructor builds separators only where needed between visible items.

Manually building separators inside itemBuilder inflates the widget count and forces Flutter to manage additional render objects, degrading performance. The separated constructor handles separator indices internally while keeping the data item builder focused on content.

Advanced Scenarios with ListView.custom

For very long or infinite lists requiring advanced features like custom reordering, paging, or complex caching, use ListView.custom with a custom SliverChildDelegate. This approach provides direct access to the underlying delegate logic while maintaining lazy-building benefits.

You can implement sophisticated loading strategies by controlling SliverChildBuilderDelegate properties such as addAutomaticKeepAlives and addRepaintBoundaries, or integrate with packages like reorderables for drag-to-reorder functionality.

Practical Implementation Examples

Basic Lazy List with ListView.builder

class TodoList extends StatelessWidget {
  final List<String> items;

  const TodoList({required this.items, super.key});

  @override
  Widget build(BuildContext context) {
    return ListView.builder(
      // Builds only visible items
      itemCount: items.length,
      itemBuilder: (BuildContext context, int index) {
        final String title = items[index];
        return ListTile(
          // Using a stable key helps preserve state on inserts/removals
          key: ValueKey(title),
          leading: const Icon(Icons.check_box_outline_blank),
          title: Text(title),
          onTap: () => print('Tapped $title'),
        );
      },
    );
  }
}

Fixed-Height Optimization with itemExtent

class FixedHeightList extends StatelessWidget {
  final List<String> items;

  const FixedHeightList({required this.items, super.key});

  @override
  Widget build(BuildContext context) {
    return ListView.builder(
      itemCount: items.length,
      // All tiles are exactly 72 dp high → layout is O(1)
      itemExtent: 72.0,
      itemBuilder: (context, index) => ListTile(
        title: Text('Item ${items[index]}'),
        trailing: const Icon(Icons.chevron_right),
      ),
    );
  }
}

List with Separators

class SeparatedTodoList extends StatelessWidget {
  final List<String> tasks;

  const SeparatedTodoList({required this.tasks, super.key});

  @override
  Widget build(BuildContext context) {
    return ListView.separated(
      itemCount: tasks.length,
      separatorBuilder: (context, _) => const Divider(height: 1),
      itemBuilder: (context, index) => ListTile(
        title: Text(tasks[index]),
        leading: const Icon(Icons.task),
        onTap: () => debugPrint('Task ${tasks[index]} selected'),
      ),
    );
  }
}

Advanced Custom Delegate

class ReorderableList extends StatefulWidget {
  final List<String> items;
  const ReorderableList({required this.items, super.key});

  @override
  State<ReorderableList> createState() => _ReorderableListState();
}

class _ReorderableListState extends State<ReorderableList> {
  late List<String> _items;

  @override
  void initState() {
    super.initState();
    _items = List.of(widget.items);
  }

  @override
  Widget build(BuildContext context) {
    return ListView.custom(
      childrenDelegate: SliverChildBuilderDelegate(
        (context, index) {
          final item = _items[index];
          return ListTile(
            key: ValueKey(item),
            title: Text(item),
          );
        },
        childCount: _items.length,
        // Enables drag‑reordering support
        addAutomaticKeepAlives: true,
        addRepaintBoundaries: true,
      ),
    );
  }
}

Key Source Files in the Flutter Framework

Understanding the implementation details in the flutter/flutter repository helps optimize your list performance:

File Purpose Location
packages/flutter/lib/src/widgets/scroll_view.dart Implements ListView.builder, ListView.separated, itemExtent, and the SliverChildBuilderDelegate lazy-loading logic. View Source
packages/flutter/lib/src/material/list_tile.dart The core ListTile widget; contains the rendering and semantics pipeline that you interact with when building list items. View Source
packages/flutter/lib/src/widgets/sliver_list.dart Underlying sliver used by ListView; useful if you need to customize scroll behavior beyond standard ListView configurations. View Source
packages/flutter/lib/src/widgets/sliver_fixed_extent_list.dart Supports the itemExtent optimisation path for fixed-height list items. View Source

Summary

To display a dynamic list of items using ListTile in Flutter without performance issues, apply these core principles:

  • Use lazy constructors: Prefer ListView.builder or ListView.separated over the default ListView to build only visible items via SliverChildBuilderDelegate.
  • Specify fixed heights: Set itemExtent when all tiles share the same height to eliminate expensive per-child layout measurements.
  • Optimize tile construction: Mark immutable widgets as const, provide stable Key objects, and avoid heavy computations inside itemBuilder.
  • Handle separators correctly: Use ListView.separated for dividers rather than building them manually inside item builders.
  • Leverage custom delegates: For advanced scenarios like infinite scrolling or complex reordering, use ListView.custom with a tailored SliverChildDelegate.

Frequently Asked Questions

Why does my Flutter app lag when scrolling through a long ListView with ListTile?

The default ListView constructor builds every child widget upfront, causing high memory usage and slow initial render times. According to the Flutter source code in packages/flutter/lib/src/widgets/scroll_view.dart, you should use ListView.builder instead, which creates a SliverChildBuilderDelegate that only constructs widgets for visible viewport indices.

When should I use ListView.separated instead of ListView.builder?

Use ListView.separated when you need dividers or spacing between items. As implemented in packages/flutter/lib/src/widgets/scroll_view.dart at line 1501, this constructor builds separators only between visible items rather than requiring you to build them manually inside the itemBuilder, which would inflate widget counts and hurt scrolling performance.

What is the benefit of setting itemExtent on a ListView?

Setting itemExtent allows the scrolling engine to calculate scroll offsets without measuring each child widget. The Flutter framework implements this optimization in packages/flutter/lib/src/widgets/sliver_fixed_extent_list.dart, reducing layout complexity from O(n) to O(1) when all items share the same height.

How do I prevent unnecessary rebuilds when my list data changes?

Provide a stable Key for each ListTile, such as ValueKey or ObjectKey based on your data's unique identifier. This allows Flutter's element tree reconciliation to preserve widget state and only rebuild modified items rather than the entire list, which is essential for maintaining 60fps scrolling performance in dynamic lists.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →