Skip to main content

avoid-flexible-outside-flex

added in: 1.24.0
Pro+

Warns when a Flexible widget is used outside the Flex widget.

Example

❌ Bad:

class SomeWidget {
Widget build() {
return Column(children: [
Expanded(),
Container(Expanded()), // LINT: Avoid Flexible widgets outside Row, Column or Flex widgets.
]);
}
}

✅ Good:

class SomeWidget {
Widget build() {
return Column(children: [
Expanded(),
Container(SomeOtherWidget()),
]);
}
}