Just checking if I’ve missed something… Why is the...
# getting-started
m
Just checking if I’ve missed something… Why is there no
Flow.distinctBy()
? For example:
Copy code
fun <T, K> Flow<T>.distinctBy(selector: (T) -> K) = flow {
    val keys = mutableSetOf<K>()
    collect { item ->
        if (keys.add(selector(item))) {
            emit(item)
        }
    }
}