prefer-prefixed-global-constants
Warns when a global constant does not start with a configured prefix.
note
This rule does not take _
into account when checking the name.
⚙️ Config
Set allowed-prefixes
(default is [k
]) to configure allowed prefixes.
dart_code_metrics:
...
rules:
...
- prefer-prefixed-global-constants:
allowed-names:
- myPrefix
Example
❌ Bad:
const String _nothing = '1'; // LINT
const String public = '1'; // LINT
const int _sValue = 1; // LINT
✅ Good:
const double _kMenuVerticalPadding = 1;
const double kPublic = 1.0;