Skip to content

Tuple2EitherOps<E, T1, T2>

extensionTuple2EitherOps<E, T1, T2>onRecord

Provides additional functions on tuple with 2 Eithers.

Properties

tupled extension no setter

Either<E,Record>gettupled

If all items of this tuple are a Right, the respective items are turned into a tuple and returned as a Right. If any item is a Left, the first Left encountered is returned.

Available on Record, provided by the Tuple2EitherOps<E, T1, T2> extension

Implementation
dart
Either<E, (T1, T2)> get tupled => $1.flatMap((a) => $2.map((b) => (a, b)));

Methods

mapN() extension

Either<E,T3>mapN<T3>(T3Function(T1,T2)fn)

Applies fn to the values of each respective tuple member if all values are a Right. If any item is a Left, the first Left encountered will be returned.

Available on Record, provided by the Tuple2EitherOps<E, T1, T2> extension

Implementation
dart
Either<E, T3> mapN<T3>(Function2<T1, T2, T3> fn) => tupled.map(fn.tupled);