It seems like this `map` and `filter` nesting shou...
# coroutines
l
It seems like this
map
and
filter
nesting should not be necessary. Any ideas how to improve it?
Copy code
filterByStarCountChannel.asFlow()
   .flatMapLatest { minStarCount ->
      userReposRepository.getUserRepos(username)
         .map { repoList ->
             repoList.filter { it.stars >= minStarCount.stars }
          }
       }
n
your getUserRepos is returning a list of lists? Am I understanding that right? If not, what are you trying to do?
l
GetUserRepos() returns Flow<List<Repo>>. I want to filter those repos based on minStarCount coming from the channel
n
I’m not too familiar with the Flow concept, so given the structure of Flow<List<Repo>>, the map + filter combination is necessary. Perhaps there is a way to use a Flow<Repo> instead?
l
No, I can’t use Flow<Repo>. Anyway, thanks for helping!