Skip to main content

binary-expression-operand-order

has auto-fix
free+

Warns when a literal value is on the left-hand side in binary expressions.

❌ Bad:

// LINT: Prefer literals at right-hand side in binary expressions.
// Try swapping the operands.
final a = 1 + b;

✅ Good:

final a = b + 1;