run<R> method

FutureOr<Either<L, dynamic>> run<R>(
  1. StateReaderTaskEither<S, C, L, R> state
)

Run the computation and returns a tuple of the result and state.

Implementation

FutureOr<Either<L, Tuple2<R, S>>> run<R>(
  StateReaderTaskEither<S, C, L, R> state,
) {
  if (_closed) {
    return Future.error('closed');
  }

  final future = _future.flatMap((_) => state(_state)(context)());

  _future = future.flatMap(
    _handleResult,
  );

  return future;
}