zip<U> method
Returns a tuple of both this
and other
if both are Some, or None otherwise.
Examples
// prints "Some((2, some))"
print(const Some(2).zip(const Some('some')));
// prints "None"
print(const Some(2).zip(const None<String>()));
Implementation
@override
@useResult
Option<(T, U)> zip<U>(Option<U> other) {
return switch (other) {
Some(value: final otherValue) => Some((value, otherValue)),
// ignore: non_const_call_to_literal_constructor
None() => None<(T, U)>(),
};
}