Is there a way to sort a collection emitted by a flow in a custom order like:
fun getList():Flow<Something>
fun main(){
launch{
getList().filter{}.map{}.sortBy{
//
}.toList()
}
}
You can apply some actions like that:
getList().transform {
//it - list
// sortedList - some function to perform sorting or something else
emit(sortedList(it))
}
UPD: You can use map(similar to "transform", but more simple) and filter(it's used to emit only specific values of the flow) functions as well to perform some actions. "transform" function allows you to perform more specific actions. In that case they are same.
getList().map {
sortedList(it)
}