Skip to content

Flutter errorFlutter: “Incorrect use of ParentDataWidget”

The console shows Incorrect use of ParentDataWidget, and part of the screen doesn’t lay out the way the code says. A few widgets only work as a direct child of one kind of parent: Expanded, Flexible and Spacer inside a Row, Column or Flex, and Positioned inside a Stack. One of them sits somewhere else, often with a Padding, Container or Center wrapped around it.

Short answer

Read the message: a line such as The offending Expanded is currently placed inside a Padding widget names the wrapper to move, and Typically, Expanded widgets are placed directly inside Flex widgets names the parent it needs. Make the Expanded, Flexible or Positioned the direct child of its Row, Column or Stack, and move any Padding or Container inside it instead of around it. Remove an Expanded that sits in a ListView, Wrap or Stack; those parents don’t use it.

Where the widget ended up, and the fix

  1. 01

    A Padding or Container around an Expanded

    “the path from the Expanded widget to its enclosing Row, Column, or Flex must contain only StatelessWidgets or StatefulWidgets” Flutter, Expanded class

    Padding, Container, Center, Opacity, Visibility and AnimatedOpacity sit between the Row and the Expanded, so the Expanded isn’t the Row’s child any more. Swap them: Expanded on the outside, the wrapper inside. A Builder, a Consumer or your own StatelessWidget in between is fine.

    // breaks: Padding sits between Row and Expanded
    Row(children: [
      Padding(
        padding: const EdgeInsets.all(8),
        child: Expanded(child: Text(title)),
      ),
    ])
    
    // works: Expanded is the Row's direct child
    Row(children: [
      Expanded(
        child: Padding(
          padding: const EdgeInsets.all(8),
          child: Text(title),
        ),
      ),
    ])
  2. 02

    An Expanded in a parent that isn’t a Row or Column

    “While Flutter's widgets are generally flexible in how they can be composed together in a UI, a small subset of those widgets expect specific parent widgets.” Flutter, Common Flutter errors

    An Expanded inside a ListView, Stack, Wrap or SizedBox has no flex layout to take part in. In a ListView, give the child a height instead; in a Stack, use Positioned or Align.

  3. 03

    A Positioned outside a Stack

    “A Positioned widget must be a descendant of a Stack” Flutter, Positioned class

    Positioned only works under a Stack, with the same rule about wrappers in between. Anywhere else, use Align or Padding to place the widget.

  4. 04

    A reusable widget that returns Expanded

    “Usually, this indicates that at least one of the offending ParentDataWidgets listed above is not placed directly inside a compatible ancestor widget.” Flutter, Common Flutter errors

    A custom widget whose build returns an Expanded works only where its caller puts it straight into a Row or Column. Move the Expanded out to the caller, so the widget can be used anywhere.

Checked against the vendor’s docs on : Flutter: Common Flutter errors (Incorrect use of ParentData widget); Flutter API: Expanded class; Flutter API: Positioned class.

Rather hand it over?

Fixed scope, fixed price, paid upfront. The work happens in writing; no call needed.

Related: Flutter “A RenderFlex overflowed” · Flutter “RenderBox was not laid out” · Flutter “setState() called during build” · Flutter “type 'Null' is not a subtype of type 'String'”

Questions

More on this error

Does Spacer count?

Yes. Spacer is built on Expanded, so it also has to be a direct child of a Row, Column or Flex.

How do I find it on a big screen?

The currently placed inside line names the wrapper, and the ownership chain after it lists the widgets above that, toward the root. Search your code for the wrapper, or select the named widget in the Flutter DevTools widget inspector.

Can you fix it for me?

If one bug is the whole problem, the App Fix Ticket covers it: a written diagnosis first, then the fix. If the app has more going on, the Launch Check is a written check of the whole app. Each issue found is rated critical, high, medium or low, with where it is and how it was confirmed. No issues worth fixing, no charge. If the Launch Check finds nothing rated medium or higher, Simon refunds the full $450. You keep the report either way. This applies to the first 10 Launch Checks bought after October 30, 2026.

A different error?

Describe it and get a written quote

Send the error and what you were doing. You get a written scope, a fixed price and a timeline; Simon replies by email, usually within one business day.