use_spacer

SeverityQuick FixOptions
Info

Details

PREFER using Spacer instead of Expanded with an empty Container or SizedBox.

Bad
Column(
  children: [
    Expanded(
      flex: 2,
      child: SizedBox(),
    ),
  ],
)
Good
Column(
  children: [
    Spacer(flex: 2),
  ],
)

Usage

To enable the use_spacer rule, add use_spacer under custom_lint > rules in your analysis_options.yaml file:

custom_lint:
  rules:
    - use_spacer