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

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


You should use Expanded only within a column, row or flex.


In this case just removing Expanded or wrapping it in a Column should fix the problem.

An Expanded widget must be a descendant of a Row, Column, or Flex

The fix for this above issue, is to move the expanded widget inside a flex widget. Example below.

Row(    children: [      Expanded(        child: Column(          children: [            Container(              padding: EdgeInsets.only(bottom: 8.0),              child: Text(                "Some Lage Somthing",                style: TextStyle(fontWeight: FontWeight.bold),              ),            ),            Text("Someplace, Country")          ],        ),      ),      Icon(Icons.star)    ],  ),);

Happy Fluttering!


First Rule: use Expanded only within a column, row or flex.

Second Rule: Parent column that have expanded child column must be wrapped with expanded as well