debouncedBy

fun <T> Flow<T>.debouncedBy(timeout: (T) -> Long, markerFactory: (T) -> Any?): Flow<T>(source)

Debounces a Flow with per-marker timeout control. Values with the same marker will be debounced independently. For each marker, only the last value within the timeout period will be emitted.

Return

A Flow that emits debounced values

Parameters

timeout

A function that determines the debounce timeout in milliseconds for each value

markerFactory

A function that produces a marker for each value. Values with the same marker are debounced together

Type Parameters

T

The type of values emitted by the flow


fun <T> Flow<T>.debouncedBy(timeout: Long, markerFactory: (T) -> Any?): Flow<T>(source)

Debounces a Flow with a fixed timeout in milliseconds and per-marker control. Values with the same marker will be debounced independently.

Return

A Flow that emits debounced values

Parameters

timeout

The debounce timeout in milliseconds

markerFactory

A function that produces a marker for each value. Values with the same marker are debounced together

Type Parameters

T

The type of values emitted by the flow


fun <T> Flow<T>.debouncedBy(timeout: Duration, markerFactory: (T) -> Any?): Flow<T>(source)

Debounces a Flow with a fixed timeout as Duration and per-marker control. Values with the same marker will be debounced independently.

Return

A Flow that emits debounced values

Parameters

timeout

The debounce timeout as a Duration

markerFactory

A function that produces a marker for each value. Values with the same marker are debounced together

Type Parameters

T

The type of values emitted by the flow