Union3<X1, X2, X3> extension type

Emulate the union of the types X1, X2, and X3.

on

Constructors

Union3.in1(X1 value)
Create a Union3 value from the first type argument.
Union3.in2(X2 value)
Create a Union3 value from the second type argument.
Union3.in3(X3 value)
Create a Union3 value from the third type argument.

Properties

as1 → X1
Return the value if it has type X1, otherwise throw.
no setter
as1OrNull → X1?
Return the value if it has type X1, otherwise null.
no setter
as2 → X2
Return the value if it has type X2, otherwise throw.
no setter
as2OrNull → X2?
Return the value if it has type X2, otherwise null.
no setter
as3 → X3
Return the value if it has type X3, otherwise throw.
no setter
as3OrNull → X3?
Return the value if it has type X3, otherwise null.
no setter
is1 bool
Return type iff the value has type X1.
no setter
is2 bool
Return type iff the value has type X2.
no setter
is3 bool
Return type iff the value has type X3.
no setter
isValid bool
Return true iff this Union3 has a type in X1 .. X3.
no setter
value Object?
final

Methods

split<R>(R on1(X1), R on2(X2), R on3(X3)) → R
splitNamed<R>({R on1(X1)?, R on2(X2)?, R on3(X3)?, R onOther(Object?)?, R onInvalid(Object?)?}) → R?