Hello, I am trying to concat two flows in a way th...
# flow
a
Hello, I am trying to concat two flows in a way that I get results sequentially when I collect on it
Copy code
flowOf(
 remoteDataSource.getDataFromCache() // suspending function returning Flow<Data>
  .catch { error -> Timber.e(error) },
 remoteDataSource.getDataFromServer() // suspending function returning Flow<Data>
).flattenConcat().collect {
Timber.i("Response Received")
}
my expectation here was that I will get first result first and then second after sometime as response comes from server. But the problem here is collect only gets called after server returns result.
.flattenMerge()
has same result as well
e
see https://proandroiddev.com/from-rxjava-2-to-kotlin-flow-threading-8618867e1955, section called “launchIn”. Maybe that helps?