Pattern: Use of field initializer in const
class
Issue: -
Instead of final x = const expr;
, you should write get x => const expr;
and
not allocate a useless field. As of April 2018 this is true for the VM, but not
for code that will be compiled to JS.
Example of incorrect code:
class A {
final a = const [];
const A();
}
Example of correct code:
class A {
get a => const [];
const A();
}