Skip to content

Latest commit

 

History

History
32 lines (24 loc) · 531 Bytes

use_const_on_env_constructors.md

File metadata and controls

32 lines (24 loc) · 531 Bytes

use_const_on_env_constructors

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');

Usage

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