Group: style
Maturity: stable
Dart SDK: >= 2.0.0 • (Linter v0.1.27)
Since info is static, may be staleDO prefer declaring variables as final if they are not reassigned later in the code.
Declaring variables as final when possible is a good practice because it helps avoid accidental reassignments and allows the compiler to do optimizations.
BAD:
void badMethod() {
var label = 'hola mundo! badMethod'; // LINT
print(label);
}
GOOD:
void goodMethod() {
final label = 'hola mundo! goodMethod';
print(label);
}
GOOD:
void mutableCase() {
var label = 'hola mundo! mutableCase';
print(label);
label = 'hello world';
print(label);
}
Incompatible with: unnecessary_final.