useZIO1<E, A, T> function

FutureOr<Exit<E, A>> Function(T _) useZIO1<E, A, T>(
  1. EIO<E, A> f(
    1. T _
    ), [
  2. List<Object?> keys = const [],
  3. bool logFailures = true
])

Implementation

FutureOr<Exit<E, A>> Function(T _) useZIO1<E, A, T>(
  EIO<E, A> Function(T _) f, [
  List<Object?> keys = const [],
  bool logFailures = true,
]) {
  final context = useContext();
  final runtime = context.getAtom(runtimeAtom);
  return useCallback(
    (_) => runtime.run(logFailures ? f(_).logged : f(_)),
    keys,
  );
}