toEither<L> method

Either<L, T> toEither<L>(
  1. L onNull()
)

Convert a nullable type T? to Either:

  • Right if the value is not null
  • Left containing the result of onNull if the value is null

Implementation

Either<L, T> toEither<L>(L Function() onNull) =>
    Either.fromNullable(this, onNull);