Union4<X1, X2, X3, X4> extension type

Emulate the union of the types X1 .. X4.

on

Constructors

Union4(Object? value)
Union4.in1(X1 value)
Create a Union4 value from the first type argument.
Union4.in2(X2 value)
Create a Union4 value from the second type argument.
Union4.in3(X3 value)
Create a Union4 value from the third type argument.
Union4.in4(X4 value)
Create a Union4 value from the fourth 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
as4 → X4
Return the value if it has type X4, otherwise throw.
no setter
as4OrNull → X4?
Return the value if it has type X4, 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
is4 bool
Return type iff the value has type X4.
no setter
isValid bool
Return true iff this Union4 has a type in X1 .. X4.
no setter
value Object?
final

Methods

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