avoid-duplicate-constant-values
Warns when a class or enum declaration has several constants with the same primitive values.
Example
❌ Bad:
enum MyEnum {
a('hi'),
b('hi'), // LINT
c('another');
final String value;
const MyEnum(this.value);
}
class RuleType {
final String value;
const RuleType._(this.value);
static const common = RuleType._('common');
static const flutter = RuleType._('common'); // LINT
}
✅ Good:
enum MyEnum {
a('hi'),
b('hello'),
c('another');
final String value;
const MyEnum(this.value);
}
class RuleType {
final String value;
const RuleType._(this.value);
static const common = RuleType._('common');
static const flutter = RuleType._('flutter');
}