I want to make multiple Post request sending a list of data and would like to receive each response to check what was submitted successfully or not.
what is the best way to implement this? I tried the following code below
private suspend fun submitConfirmWeights(): Flow<Boolean> = flow {
syncRepositoryImpl.getOfflineShopCollections().collect {
it.forEach { weight ->
val response = confirmWeightsService.confirmWeights(confirmWeightsDtoMapper.mapFromDomainModel(weight))
if (response.isSuccessful && response.body()?.status == true){
emit(true)
}else{
emit(false)
}
}
}
}