map Success
public final Resource<U> mapSuccess<U extends Any>(SuspendFunction1<Resource.Success<T>, Resource<U>> block)
Utility method to chain API resource requests by mapping the successful resource request to the resource returned by the block.
Errors or cancellations are forwarded via copying and will prevent subsequent success mappings. For example if requests for Resource<A>
, Resource<B>
, and Resource<C>
are chained, then if Resource<A>
fails the success mapping blocks for Resource<B>
and Resource<C>
won't be called. Instead the error will be copied to Resource<B>
's and then to Resource<C>
's Error instance. The returned Resource will be a Resource<C>.Error
instance.