Skip to content

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

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, in strict.

A value without brackets calls the same constructor with the same empty arguments.

Violating
enum Side { left(), right }
Corrected
enum Side { left, right }

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.

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.