Does it make sense to add the `flowOn` here: ```in...
# coroutines
d
Does it make sense to add the
flowOn
here:
Copy code
inline fun <reified T : Any, reified R : Any> Flow<T>.concurrentMap(
	dispatcher: CoroutineDispatcher = <http://Dispatchers.IO|Dispatchers.IO>,
	crossinline mapFun: suspend (T) -> R
)Flow<R> = flatMapMerge {
	flow { emit(mapFun(it)) }.flowOn(dispatcher)
}
?
z
Looks fine to me
d
I was thinking that flatMapMerge already uses some dispatcher for concurrency, so that this might be unnecessary?
z
All coroutines use a dispatcher, this is useful if you want to map to happen on a different dispatcher (which makes sense, since it’s common for flows to be collected on
Main
or
Default
).