proper_from_environment
Severity | Quick Fix | Options |
---|---|---|
Error | ✅ | ❌ |
Details
DO use const
when invoking bool.fromEnvironment
, int.fromEnvironment
and String.fromEnvironment
.
The constructors bool.fromEnvironment
, int.fromEnvironment
and String.fromEnvironment
are only guaranteed to work when invoked as a const
constructor.
see: dart-lang-issue
Bad
final boolean = bool.fromEnvironment('bool');
int integer = int.fromEnvironment('int');
var string = String.fromEnvironment('String');
Good
const boolean = bool.fromEnvironment('bool');
const integer = int.fromEnvironment('int');
const string = String.fromEnvironment('String');