withValueNotifier<L, R> function

FutureOr<Either<L, R>> withValueNotifier<L, R>(
  1. ValueNotifier<TaskEitherValue<L, R>> notifier,
  2. TaskEither<L, R> task
)

Implementation

FutureOr<Either<L, R>> withValueNotifier<L, R>(
  ValueNotifier<TaskEitherValue<L, R>> notifier,
  TaskEither<L, R> task,
) {
  notifier.value = asLoading(notifier.value);
  return task().flatMap((a) {
    notifier.value = fromEither(a);
    return a;
  });
}