VariantDef class

Variant in an enum type

Represents a single variant in an enum, similar to Rust enum variants. Each variant has a name, discriminant index, optional fields, and documentation.

Constructors

VariantDef({required String name, required List<Field> fields, required int index, List<String> docs = const []})
const

Properties

docs → List<String>
Documentation for this variant
final
fields → List<Field>
Fields in this variant
final
hashCode → int
The hash code for this object.
no setterinherited
index → int
Index/discriminant of the variant
final
name → String
Name of the variant
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, dynamic>
toString() → String
A string representation of this object.
inherited
typeDependencies() → Set<int>

Operators

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

Constants

codec → const $VariantDef
Codec instance for VariantDef