Skip to main content

avoid-use-expanded-as-spacer

added in: 4.17.0
warning
🛠

The rule detects Expanded widgets that contain empty SizedBox/Container and proposes to replace them with the Spacer widget.

Example

❌ Bad:

Column(
children: [
Container(),
const Expanded(child: SizedBox()),
Container(),
]
)

✅ Good:

Column(
children: [
Container(),
const Spacer(),
Container(),
]
)