Union class

An SumType that contains every type defined by taking the DataAnnotation.typeParams and applying them to every key in the body.

Each key generates the corresponding class, every one of them with an unnamed constructor that requires every argument from the respective value in body.

The visit function, used to destructure the union is configured by deriveMode, and optionally an top level version of it is generated, according to topLevel.

The structural implements flag controls whether or not union cases that match structurally will be implemented in other cases

Inheritance

Constructors

Union(Map<Symbol, Map<Symbol, TypeD>> body, {UnionVisitDeriveMode deriveMode = UnionVisitDeriveMode.auto, Map<Symbol, Methods> caseMethods = const {}, bool topLevel = false, bool deriveNamed = true, bool structuralImplements = true})
const

Properties

body Map<Symbol, Map<Symbol, TypeD>>
final
caseMethods Map<Symbol, Methods>
final
deriveMode UnionVisitDeriveMode
final
deriveNamed bool
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
structuralImplements bool
final
topLevel bool
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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