Skip to main content

avoid-unnecessary-enum-arguments

added in: 1.22.0
🛠
Pro+

Warns when a enum constant has an unnecessary empty argument list.

Example

❌ Bad:

enum MyEnum {
alpha.named(),
beta.named(),
gama(); // LINT

final String value;

const MyEnum.named() : value = '2';

const MyEnum() : value = '3';
}

✅ Good:

enum MyEnum {
alpha.named(),
beta.named(),
gama;

final String value;

const MyEnum.named() : value = '2';

const MyEnum() : value = '3';
}