maybeMap<_T> method
_T
maybeMap<_T>({
- required _T orElse(),
- _T ref(
- CompValueRef<
T> value
- CompValueRef<
- _T single(
- CompValueSingle<
T> value
- CompValueSingle<
- _T list(
- CompValueList<
T> value
- CompValueList<
Implementation
_T maybeMap<_T>({
required _T Function() orElse,
_T Function(CompValueRef<T> value)? ref,
_T Function(CompValueSingle<T> value)? single,
_T Function(CompValueList<T> value)? list,
}) {
final v = this;
if (v is CompValueRef<T>) {
return ref != null ? ref(v) : orElse.call();
} else if (v is CompValueSingle<T>) {
return single != null ? single(v) : orElse.call();
} else if (v is CompValueList<T>) {
return list != null ? list(v) : orElse.call();
}
throw Exception();
}