Skip to main content

Tag name

Rule id

tag-name

Severity

Warning

Description

Warns when tag name does not match class name.

Config example

We recommend exclude the test folder.

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