prefer_border_from_border_side
Severity | Quick Fix | Options |
---|---|---|
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,
),
),
),
)