distinctUntilChanged

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

Note that any instance of StateFlow already behaves as if distinctUntilChanged 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: (old: T, new: T) -> Boolean): Flow<T>(source)

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.