avoid-single-child-column-or-row
Warns when a Column
, Row
, Flex
, Wrap
, SliverList
, SliverMainAxisGroup
or SliverCrossAxisGroup
widget has only one child.
Example
❌ Bad:
Widget build(BuildContext context) {
return Row(children: [
SomeWidget(), // LINT
]);
}
✅ Good:
Widget build(BuildContext context) {
return Row(children: [
SomeWidget(),
SomeWidget(),
]);
}
Widget build(BuildContext context) {
return Center(child: SomeWidget());
}