Pattern: Missing use of const
constructor
Issue: -
If a const
constructor is available, it is preferable to use it.
Example of correct code:
class A {
const A();
}
void accessA() {
A a = const A();
}
Example of correct code:
class A {
final int x;
const A(this.x);
}
A foo(int x) => new A(x);
Example of incorrect code:
class A {
const A();
}
void accessA() {
A a = new A();
}