You can't use an environment constructor if it's not a constant.
BAD:
final foo = String.fromEnvironment('foo');
GOOD:
const foo = String.fromEnvironment('foo');
GOOD:
final foo = const String.fromEnvironment('foo');
To disable this lint in your project add this to your package's analysis_options.yaml file:
analyzer:
plugins:
- custom_lint
custom_lint:
rules:
- use_const_on_env_constructors: false