flatMapThrowable<B> method

FutureOr<B> flatMapThrowable<B>(
  1. FutureOr<B> f(
    1. A a
    ),
  2. B onError(
    1. dynamic error,
    2. StackTrace stackTrace
    )
)

Implementation

FutureOr<B> flatMapThrowable<B>(
  FutureOr<B> Function(A a) f,
  B Function(dynamic error, StackTrace stackTrace) onError,
) {
  if (this is Future) {
    return (this as Future<A>).then(f, onError: onError);
  } else {
    try {
      return f(this as A);
    } catch (err, stack) {
      return onError(err, stack);
    }
  }
}