Skip to main content

avoid-expanded-as-spacer

has auto-fix
free+

Suggests using the Spacer widget instead of the Expanded widget containing empty SizedBox/Container widget.

Example

❌ Bad:

Column(
children: [
Container(),
// LINT: Prefer replacing this widget with the 'Spacer' widget.
const Expanded(child: SizedBox()),
Container(),
],
);

✅ Good:

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