Skip to main content

tag-name

added in: 4.12.0
warning
⚙️🛠

Warns when tag name does not match class name.

⚙️ Config example

dart_code_metrics:
...
rules:
...
- tag-name:
var-names: [_kTag]
strip-prefix: _
strip-postfix: State
...

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