T
T
Tsuzukeru2021-12-06 19:12:05
Android
Tsuzukeru, 2021-12-06 19:12:05

How to flatmap List in Coroutines Flow?

There is this method:

private suspend fun getPhotoFileList(photoUrlList: List<String>): List<File?> {
        return photoUrlList.map { downloadCarPhotoUseCase(it).first() }
    }

A list of strings is converted to a list of files. Can this be rewritten in a nicer way? Like flatmap in Rx.
first() is a method to get value from flow

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question