empty_enum_constant_arguments
Reports an empty argument list on an enum value: left(). Drop the brackets.
- Tier
- advisory
- Scope
- Dart
- Lowest preset
- recommended
- Fix
- deletes the brackets
What it reports
Section titled “What it reports”An empty argument list of a value of an enum: enum Side { left(), right }. The violation is on the brackets.
It does not report:
- a value that names a constructor,
left.named(); - a value with type arguments;
- a value with any argument, even one equal to the default. That is the SDK lint
avoid_redundant_argument_values, instrict.
A value without brackets calls the same constructor with the same empty arguments.
Example
Section titled “Example”Violating
enum Side { left(), right }Corrected
enum Side { left, right }Rule parameters
Section titled “Rule parameters”Set under the assay: key of the project’s root analysis_options.yaml.
| Rule parameter | Default | Effect |
|---|---|---|
enabled |
true |
false switches the rule off for the whole project. |
exclude |
[] |
Path globs where the rule is silent. |
Suppressing it
Section titled “Suppressing it”Write why on the line directly above the suppression:
// Why it stays as written here.// ignore: empty_enum_constant_arguments// ignore_for_file: assay/empty_enum_constant_arguments silences it in a whole file, and // ignore: assay/empty_enum_constant_arguments with the prefix works too. See Suppressions.