Skip to main content

prefer-sized-box-square

added in: 1.24.0
🛠
Pro+

Suggests using the SizedBox.square constructor when height and width arguments have the same value.

Example

❌ Bad:

// LINT: Prefer using 'SizedBox.square' when the width and height are equal.
SizedBox(height: 10, width: 10);

✅ Good:

SizedBox(height: 10);
SizedBox(width: 10);

SizedBox(height: 10, width: 5);
SizedBox.square(dimension: 10);