close

[Solved] expanded widgets must be placed inside flex widgets

Hello Guys, How are you all? Hope You all Are Fine. Today I am just trying to use expanded but I am facing following error incorrect use of parent data widget. expanded widgets must be placed inside flex widgets in flutter. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How expanded widgets must be placed inside flex widgets Error Occurs ?

I am just trying to use expanded but I am facing following error.

incorrect use of parent data widget. expanded widgets must be placed inside flex widgets

How To Solve expanded widgets must be placed inside flex widgets Error ?

  1. How To Solve expanded widgets must be placed inside flex widgets Error ?

    To Solve expanded widgets must be placed inside flex widgets Error You Just need to use Expanded only within a columnrow or flex. Or Just Wrap Expanded with Row And Also Just Wrap Expanded with Column Of Flex will solve your error.

  2. expanded widgets must be placed inside flex widgets

    To Solve expanded widgets must be placed inside flex widgets Error You Just need to use Expanded only within a columnrow or flex. Or Just Wrap Expanded with Row And Also Just Wrap Expanded with Column Of Flex will solve your error.

Solution 1: Use expanded with this widget

You Just need to use Expanded only within a columnrow or flex.

Solution 2: Wrap Expanded with Row

Just Wrap Expanded with Row

Row(
  children: [
    Expanded(
      child: MyWidget(),
    ),
  ],
)

Solution 3: Wrap Expanded with Column

Just Wrap Expanded with Column

Column(
  children: [
    Expanded(
      child: MyWidget(),
    ),
  ],
)

Summary

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also, Read

Leave a Comment