fromValue2<T0, T1> static method
Implementation
static OneOf2<T0, T1> fromValue2<T0, T1>({
required Object? value,
int? typeIndex,
Type? type,
}) {
typeIndex = _guessTypeIndex(
types: [T0, T1],
type: type,
typeIndex: typeIndex,
value: value,
);
if (typeIndex == null) {
//try to determine typeIndex by checking value type
if (value is T0) {
typeIndex = 0;
} else if (value is T1) {
typeIndex = 1;
}
}
_throwIfFailedAttempt(typeIndex);
return OneOf2(value: value, typeIndex: typeIndex!);
}