findOrNull method
Returns the Right.value matching the given predicate
,
or null
if this is a Left or Right.value does not match.
Implementation
R? findOrNull(bool Function(R value) predicate) {
if (isLeft) {
return null;
}
assert(isRight);
final value = _unionValue as R;
return predicate(value) ? value : null;
}