Either<L, R>.condition constructor

Either<L, R>.condition({
  1. required bool test,
  2. required L leftValue,
  3. required R rightValue,
})

If the condition is test then return rightValue in Right else leftValue in Left

Implementation

factory Either.condition({
  required bool test,
  required L leftValue,
  required R rightValue,
}) =>
    test ? Right<L, R>(rightValue) : Left<L, R>(leftValue);