mapWait<R> method

Future<ResourceTry<R>> mapWait<R>(
  1. Future<R> transform(
    1. SuccessT value
    )
)

Implementation

Future<ResourceTry<R>> mapWait<R>(
    Future<R> Function(SuccessT value) transform) async {
  try {
    return ResourceTry.success((await transform(getOrThrow())));
  } on Exception catch (e) {
    return ResourceTry.failure(ResourceException.wrap(e));
  } on OutOfMemoryError catch (e) {
    // We don't want to catch any Error, only OOM.
    return ResourceTry.failure(ResourceException.wrap(e));
  }
}