prefer_const_declarations

Group: style

Maturity: stable

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

Since info is static, may be stale

View all Lint Rules

Using the Linter

PREFER using const for const declarations.

Const declarations are more hot-reload friendly and allow to use const constructors if an instantiation references this declaration.

GOOD:

const o = <int>[];

class A {
  static const o = <int>[];
}

BAD:

final o = const <int>[];

class A {
  static final o = const <int>[];
}