prefer_const_literals_to_create_immutables

Group: style

Maturity: stable

Linter v0.1.43

Since info is static, may be stale
flutterhas-fix

View all Lint Rules

Using the Linter

PREFER using const for instantiating list, map and set literals used as parameters in immutable class instantiations.

BAD:

@immutable
class A {
  A(this.v);
  final v;
}

A a1 = new A([1]);
A a2 = new A({});

GOOD:

A a1 = new A(const [1]);
A a2 = new A(const {});