Incorrect use of ParentData Widget. Expanded widget Must be Placed Inside the flex widget.

Expanded should only be descendant of a column, row or flex.

So, if anywhere expanded is Present in other than column , row or flex widget, try removing those widget.

For Example → Simply Using the Expanded wiget in the Conatiner can cause Error.


Container(
child: Text(
"Hello",
style: TextStyle(fontWeight: FontWeight.bold),
),
child: Expanded(
child: Text("HEY")
),
),

Try to wrap it in Column / Row or Flex Widget.

 Column(
children: [
Container(
child: Text(
"Hello",
style: TextStyle(fontWeight: FontWeight.bold),
),
),
Expanded(
child: Text("Hey"),
),
],
);

Simply wrap Expanded in the Row/Column or Flex widget and your Problem will be Solved.

Feel free to ask if you face any issue regarding this.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store