flatMapFirst

fun <T, R> Flow<T>.flatMapFirst(transform: suspend (value: T) -> Flow<R>): Flow<R>(source)

Projects each source value to a Flow which is merged in the output Flow only if the previous projected Flow has completed. If value is received while there is some projected Flow sequence being merged, it will simply be ignored.

This method is a shortcut for map(transform).flattenFirst(). See flattenFirst.

Operator fusion

Applications of flowOn, buffer, and produceIn after this operator are fused with its concurrent merging so that only one properly configured channel is used for execution of merging logic.

Parameters

transform

A transform function to apply to value that was observed while no Flow is executing in parallel.