StandardEnumFieldDeclaration class final

Concrete implementation of EnumFieldDeclaration representing an enum value.

Provides standard reflective access to enum values with efficient storage of the name, value, and parent enum reference.

{@template standard_enum_field_declaration_features}

Key Features

  • Lightweight immutable implementation
  • Efficient value storage
  • JSON serialization support
  • Value equality comparison
  • Debug identifiers

Typical Usage

Used by code generators and runtime systems to represent enum values in reflection contexts.

Example Creation

enum Status { active, paused }

final enumDecl = StandardEnumDeclaration(
  'Status', 
  Status.values,
  Status.type
);

final field = StandardEnumFieldDeclaration(
  'active',
  Status.active,
  enumDecl
);

{@endtemplate}

Inheritance
Implemented types

Constructors

StandardEnumFieldDeclaration({required String name, Element? element, DartType? dartType, required Type type, required bool isPublic, required bool isSynthetic, required dynamic value, required int position, required LibraryDeclaration libraryDeclaration, List<AnnotationDeclaration> annotations = const [], required bool isNullable})
Creates a standard enum field declaration
const

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

equalizedProperties() List<Object?>
Mixin-style contract for value-based equality, hashCode, and toString.
override
getAnnotations() List<AnnotationDeclaration>
Returns all annotations applied to this declaration.
inherited
getDartType() → DartType?
The analyzer DartType of the entity for enhanced type operations.
inherited
getDebugIdentifier() String
The debug identifier for the entity.
override
getElement() → Element?
The analyzer element associated with this declaration.
inherited
getIsPublic() bool
Checks if this declaration is a public declaration.
inherited
getIsSynthetic() bool
Checks if a declaration is a synthetic declaration.
inherited
getName() String
Gets the name of the declared element.
inherited
getParentLibrary() LibraryDeclaration
Returns the LibraryDeclaration in which this declaration is defined.
inherited
getPosition() int
This is the position of the enum field, as-is on the enum class.
override
getSourceLocation() Uri?
Returns the source code location (e.g., file path or URI) where this declaration is defined, or null if not available in the current reflection context.
inherited
getType() Type
Gets the runtime type of the declared element.
inherited
getValue() → dynamic
Gets the runtime value of this enum field.
override
hasAnalyzerSupport() bool
Returns true if this declaration has analyzer information available.
inherited
isNullable() bool
Returns true if the field is nullable.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, Object>
Returns a JSON representation of this entity.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited