prefer_border_from_border_side

SeverityQuick FixOptions
Info

Details

PREFER using Border.fromBorderSide instead of Border.all.

Using Border.fromBorderSide is more efficient than Border.all because of possible const constructor usage.

Bad
DecoratedBox(
  decoration: BoxDecoration(
    border: Border.all(
      width: 1,
      style: BorderStyle.solid,
    ),
  ),
)
Good
const DecoratedBox(
  decoration: BoxDecoration(
    border: Border.fromBorderSide(
      BorderSide(
        width: 1,
        style: BorderStyle.solid,
      ),
    ),
  ),
)

Usage

To enable the prefer_border_from_border_side rule, add prefer_border_from_border_side under plugins > pyramid_lint > diagnostics in your analysis_options.yaml file:

plugins:
  pyramid_lint: <version>
    diagnostics:
      prefer_border_from_border_side: true