tag-name
added in: 1.6.0
warning
Warns when tag name does not match class name.
⚙️ Config
Set var-names
(default is none) to configure the list of fields to check.
Set strip-prefix
(default is none) to configure the prefix to ignore.
Set strip-postfix
(default is none) to configure the postfix to ignore.
dart_code_metrics:
...
rules:
...
- tag-name:
var-names: [_kTag]
strip-prefix: _
strip-postfix: State
...
note
This rule requires configuration in order to highlight any issues.
Example
❌ Bad:
class Apple {
static const _kTag = 'Orange'; // LINT
}
class _OrangeState {
static const _kTag = 'Apple'; // LINT
}
✅ Good:
class Apple {
static const _kTag = 'Apple';
}
class _OrangeState {
static const _kTag = 'Orange';
}