distinctUntilChanged

fun <T> Flow<T>.distinctUntilChanged(): Flow<T>

Returns flow where all subsequent repetitions of the same value are filtered out.

Note that any instance of StateFlow already behaves as if distinctUtilChanged operator is applied to it, so applying distinctUntilChanged to a StateFlow has no effect. See StateFlow documentation on Operator Fusion. Also, repeated application of distinctUntilChanged operator on any flow has no effect.


fun <T> Flow<T>.distinctUntilChanged(areEquivalent: (T, T) -> Boolean): Flow<T>

Returns flow where all subsequent repetitions of the same value are filtered out, when compared with each other via the provided areEquivalent function.

Note that repeated application of distinctUntilChanged operator with the same parameter has no effect.