Flutter error: Each child must be laid out exactly once. On building layout Flutter error: Each child must be laid out exactly once. On building layout android android

Flutter error: Each child must be laid out exactly once. On building layout


Hi i just had the same problem i think its just a bug in flutter.Stop and then reinstall your app


Recently I had the same error.

In my case the error was caused by nesting two Expanded Widgets into each other.

The error has gone by removing the parent Expanded Widget.


It's not a bug from flutter, I had faced the same issue, although the above solution is correct it seems to fail sometimes.

Try the following command

flutter clean

and

flutter pub get

then run again

flutter run

or

alternatively, if you're on Android Studio (flutter plugins enabled)

Go to Tools > Flutter > Flutter Clean

then run the app again,will do the same as the above commands

EDIT:After being familiar with Flutter for about a week, now I do understand that making changes in code such as adding in a new dependency in pubspec.yaml requires stopping the app and Running again, I did notice that the GUI in the IDE (I use Android Studio) might have some issue, the above commands in the command line works just fine.

Happy Coding :)