prefer_const_constructors_in_immutables

Group: style

Maturity: stable

Dart SDK: >= 2.0.0 • (Linter v0.1.33)

Since info is static, may be stale

View all Lint Rules

Using the Linter

PREFER declaring const constructors on @immutable classes.

If a class is immutable, it is usually a good idea to make its constructor a const constructor.

GOOD:

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

BAD:

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