map2<A, B, R> function
Creates a function that accepts two Option's, and if both of them are Some, then the transformer function is called with the unwrapped values.
final transform = map2((int a, int b) => a + b);
expect(transform(some(1), some(2)), some(3));
expect(transform(some(1), none()), none());
Implementation
Option<R> Function(Option<A> optionA, Option<B> optionB) map2<A, B, R>(
R Function(A a, B b) f,
) =>
(a, b) => a._bindSome((a) => b._bindSome((b) => some(f(a, b))));