flatMapThrowable<B> method

ZIO<R, E, B> flatMapThrowable<B>(
  1. FutureOr<B> f(
    1. A _
    ),
  2. E onThrow(
    1. dynamic error,
    2. StackTrace stack
    )
)

A variant of flatMap that uses the result of the given function. If the given function throws an error, the resulting ZIO will fail with the result of onThrow.

Implementation

ZIO<R, E, B> flatMapThrowable<B>(
  FutureOr<B> Function(A _) f,
  E Function(dynamic error, StackTrace stack) onThrow,
) =>
    flatMap((a) => ZIO.tryCatch(() => f(a), onThrow));