Pattern: Unnecessary late
modifier
Issue: -
DO not specify the late
modifier for top-level and static variables
when the declaration contains an initializer.
Top-level and static variables with initializers are already evaluated lazily
as if they are marked late
.
Example of incorrect code:
late String badTopLevel = '';
Example of correct code:
String goodTopLevel = '';
Example of incorrect code:
class BadExample {
static late String badStatic = '';
}
Example of correct code:
class GoodExample {
late String goodStatic;
}