Skip to main content

avoid-expanded-as-spacer

added in: 1.6.0
🛠

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(),
]
)