Skip to content

EitherTuple2Ops<E, T1, T2>

extensionEitherTuple2Ops<E, T1, T2>onEither<E,Record>

Provides additional functions on an Either where the right value is a 2 element tuple.

Methods

ensureN() extension

Either<E,Record>ensureN(boolFunction(T1,T2)p,EFunction()onFailure,);

Available on Either<A, B>, provided by the EitherTuple2Ops<E, T1, T2> extension

Implementation
dart
Either<E, (T1, T2)> ensureN(
  Function2<T1, T2, bool> p,
  Function0<E> onFailure,
) => ensure(p.tupled, onFailure);

filterOrElseN() extension

Either<E,Record>filterOrElseN(boolFunction(T1,T2)p,EFunction()zero,);

Available on Either<A, B>, provided by the EitherTuple2Ops<E, T1, T2> extension

Implementation
dart
Either<E, (T1, T2)> filterOrElseN(
  Function2<T1, T2, bool> p,
  Function0<E> zero,
) => filterOrElse(p.tupled, zero);

flatMapN() extension

Either<E,T3>flatMapN<T3>(Either<E,T3>Function(T1,T2)f)

Available on Either<A, B>, provided by the EitherTuple2Ops<E, T1, T2> extension

Implementation
dart
Either<E, T3> flatMapN<T3>(Function2<T1, T2, Either<E, T3>> f) => flatMap(f.tupled);

foldN() extension

T3foldN<T3>(T3Function(E)f,T3Function(T1,T2)g)

Available on Either<A, B>, provided by the EitherTuple2Ops<E, T1, T2> extension

Implementation
dart
T3 foldN<T3>(
  Function1<E, T3> f,
  Function2<T1, T2, T3> g,
) => fold(f, g.tupled);

foreachN() extension

voidforeachN(voidFunction(T1,T2)f)

Available on Either<A, B>, provided by the EitherTuple2Ops<E, T1, T2> extension

Implementation
dart
void foreachN(Function2<T1, T2, void> f) => foreach(f.tupled);

mapN() extension

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

Available on Either<A, B>, provided by the EitherTuple2Ops<E, T1, T2> extension

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