Skip to content

EnumName

extension EnumName on Enum

Annotations: @Since.new("2.15")

Access to the name of an enum value.

This method is declared as an extension method instead of an instance method in order to allow enum values to have the name name.

Properties

name extension no setter

String get name

The name of the enum value.

The name is a string containing the source identifier used to declare the enum value.

For example, given a declaration like:

dart
enum MyEnum {
  value1,
  value2
}

the result of MyEnum.value1.name is the string "value1".

Available on Enum, provided by the EnumName extension

Implementation
dart
String get name => _name;