fromEither<L, R> static method

Option<R> fromEither<L, R>(
  1. Either<L, R> either
)

Build a Option from a Either by returning Some when either is Right, None otherwise.

Implementation

static Option<R> fromEither<L, R>(Either<L, R> either) =>
    either.match((_) => const Option.none(), (r) => Some(r));