Why this matters
SizedBox is a lightweight alternative to Container when only spacing is needed, reducing unnecessary widget complexity.
SizedBox Over Container for SpacingUse SizedBox instead of Container when adding spacing in layouts to improve performance and avoid unnecessary rendering overhead.
SizedBox is a lightweight alternative to Container when only spacing is needed, reducing unnecessary widget complexity.
Side-by-side examples engineers can pattern-match during review.
List<Widget> widgets(){
return [
Container(width: 4, height: 5),
Container(key: Key("MyWidget"), child: MyWidget(), height: 5)
];
}List<Widget> widgets(){
return [
SizedBox(width: 4, height: 5),
SizedBox(key: Key("MyWidget"), child: MyWidget(), height: 5)
];
}From the same buckets as this rule.
All static JS/CSS/font/image files MUST use content-hashed filenames (e.g., app.9c1a7b.js) and be served with "Cache-Control: public, max-age=31536000, immutable". HTML and other non-fingerprinted documents MUST be served with "Cache-Control: no-cache" (or equivalent) to enable conditional revalidation.