toFuture method

Future<R> toFuture()

Convert this Either to a Future. If this is Right, the Future will complete with Right.value as its value. Otherwise, the result Future will complete with Left.value as its error.

Implementation

Future<R> toFuture() => fold(
      ifLeft: (e) => Future.error(e),
      ifRight: (v) => Future.value(v),
    );