Open Hixie opened 1 year ago
/fyi @parlough @bwilkerson @MaryaBelanger
I might be wrong, but my interpretation of the documentation is that the lint attempts to prevent any use of either fromEnvironment
or hasEnvironment
without any consideration of whether the use is at compile-time or run-time.
I suspect that the docs could be enhanced, possibly as part of the re-write, to make this more clear. The example might also want to drop the const
as I don't think it's important but might be part of what led to the misunderstanding.
The
do_not_use_environment
lint tries to catch compile-time use of environment variables, that should be runtime uses. The message, though, is entirely unclear about this. It just says:For example, here is some code that triggers this lint:
Also while I'm at it I should observe that the documentation (https://dart-lang.github.io/linter/lints/do_not_use_environment.html) does not give a "GOOD" code snippet.