Variant3<T0, T1, T2> class sealed

A type-safe discriminated union holding either T0, T1, or T2.

Implementers

Constructors

Variant3.withT0(T0 value)
Creates a variant holding a T0 value.
factory
Variant3.withT1(T1 value)
Creates a variant holding a T1 value.
factory
Variant3.withT2(T2 value)
Creates a variant holding a T2 value.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
index int
Gets the 0-based index of the active alternative.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value Object?
Gets the current active value dynamically.
no setter

Methods

holdsAlternative<T>() bool
Checks if the variant currently holds the specified type alternative.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
visit<R>({required R onT0(T0), required R onT1(T1), required R onT2(T2)}) → R
Visits the underlying value with exhaustive matching.

Operators

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