do_not_use_environment
Do not use environment declared variables.
This rule is available as of Dart 2.9.
Details
#Using values derived from the environment at compile-time, creates hidden global state and makes applications hard to understand and maintain.
DON'T use fromEnvironment
or hasEnvironment
factory constructors.
BAD:
const loggingLevel =
bool.hasEnvironment('logging') ? String.fromEnvironment('logging') : null;
Usage
#To enable the do_not_use_environment
rule, add do_not_use_environment
under linter > rules in your analysis_options.yaml
file:
linter:
rules:
- do_not_use_environment
Unless stated otherwise, the documentation on this site reflects Dart 3.6.0. Page last updated on 2024-07-03. View source or report an issue.