Flutter: Incorrect use of ParentDataWidget. The ParentDataWidget Expanded(flex: 1) wants to apply ParentData of type FlexParentData to a RenderObject
A widget like Expanded, Flexible, Positioned or TableCell was placed under a parent that does not support it.
Incorrect use of ParentDataWidgetThe ParentDataWidget Expanded wants to apply ParentData of type FlexParentDataThe ParentDataWidget Positioned wants to apply StackParentDataTypically, Expanded widgets are placed directly inside Flex widgetsParentDataWidget incorrect use Meaning
These widgets must be a direct child of a specific parent: Expanded/Flexible of Row/Column/Flex, Positioned of Stack, TableCell of TableRow. Extra wrappers such as Padding or Container between them break the relationship. Move the widget directly under the right parent.
Common causes
- Expanded inside a Container, Padding or SizedBox instead of directly under a Row/Column
- Positioned used outside a Stack
- Expanded inside a ListView or Stack
- Widget wrapper inserted between Expanded and Row
- TableCell outside TableRow
⚡ Quick fix
- Make Expanded/Flexible a direct child of Row/Column/Flex
- Put Positioned directly inside Stack
- Move wrappers (Padding, Center) inside the Expanded
Detailed fix by platform
Flutter
- Fix pattern:
Row(children: [Expanded(child: Padding(padding: EdgeInsets.all(8), child: Text('x')))])
How to diagnose
- Widget — Expanded, Positioned or TableCell?
- Parent — Correct direct parent?
- Wrapper — Anything in between?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- A RenderFlex overflowed Flutter: A RenderFlex overflowed by x pixels on the right/bottom
- Android license status unknown / licenses not accepted flutter doctor: Android license status unknown. Run `flutter doctor --android-licenses` to accept the SDK licenses
- BoxConstraints forces an infinite width Flutter: BoxConstraints forces an infinite width. These invalid constraints were provided to RenderStack's layout() function (TextField in a Row)
Most viewed in Flutter / Dart
- setState() called after dispose() Flutter: setState() called after dispose(): _MyState#1a2b3 (lifecycle state: defunct, not mounted)
- Null check operator used on a null value Dart/Flutter: Null check operator used on a null value
- SocketException: Failed host lookup Flutter: Unhandled Exception: SocketException: Failed host lookup: 'api.example.com' (OS Error: No address associated with hostname, errno = 7)
Other ways to find it
Where this error sits
Origin: On your device. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 4 Nov 2026