Why This Happens
In Flutter, ListView has infinite height by default and Column gives its children unbounded vertical space. Placing a ListView directly inside a Column without constraints causes this error because both try to be infinitely tall. Wrap the ListView in Expanded or give it a fixed height.
The Problem
Column(
children: [
Text('Header'),
ListView(
children: items.map((e) => ListTile(title: Text(e))).toList(),
),
],
)The Fix
Column(
children: [
Text('Header'),
Expanded(
child: ListView(
children: items.map((e) => ListTile(title: Text(e))).toList(),
),
),
],
)Step-by-Step Fix
- 1
Identify the error
Look at the error message: Vertical viewport was given unbounded height. This means a scrollable widget has no height constraint.
- 2
Find the cause
Check if a ListView, GridView, or CustomScrollView is placed inside a Column, Row, or another unconstrained parent.
- 3
Apply the fix
Wrap the scrollable widget in Expanded or SizedBox to provide a bounded height, or set shrinkWrap: true on the ListView.
Bugsly catches this automatically
Bugsly's AI analyzes this error pattern in real-time, explains what went wrong in plain English, and suggests the exact fix — before your users even report it.
Try Bugsly free