select

Select a sub-state from the State and emit it if it is different from the previous one.

Parameters

selector

A function that takes the State and returns a sub-state.


fun <State, SubState1, SubState2, Result> Flow<State>.select(selector1: Selector<State, SubState1>, selector2: Selector<State, SubState2>, projector: suspend (subState1: SubState1, subState2: SubState2) -> Result): Flow<Result>(source)

Select two sub-states from the source Flow and combine them into a Result.

The projector will be invoked only when one of the sub-states is changed. The returned flow will emit the result of projector, and all subsequent results repetitions of the same value are filtered out (same as distinctUntilChanged).

Parameters

selector1

The first selector to be used to select first sub-states.

selector2

The second selector to be used to select second sub-states.

projector

The projector to be used to combine the sub-states into a result.


fun <State, SubState1, SubState2, SubState3, Result> Flow<State>.select(selector1: Selector<State, SubState1>, selector2: Selector<State, SubState2>, selector3: Selector<State, SubState3>, projector: suspend (subState1: SubState1, subState2: SubState2, subState3: SubState3) -> Result): Flow<Result>(source)

Select three sub-states from the source Flow and combine them into a Result.

The projector will be invoked only when one of the sub-states is changed. The returned flow will emit the result of projector, and all subsequent results repetitions of the same value are filtered out (same as distinctUntilChanged).

Parameters

selector1

The first selector to be used to select first sub-states.

selector2

The second selector to be used to select second sub-states.

selector3

The third selector to be used to select third sub-states.

projector

The projector to be used to combine the sub-states into a result.


fun <State, SubState1, SubState2, SubState3, SubState4, Result> Flow<State>.select(selector1: Selector<State, SubState1>, selector2: Selector<State, SubState2>, selector3: Selector<State, SubState3>, selector4: Selector<State, SubState4>, projector: suspend (subState1: SubState1, subState2: SubState2, subState3: SubState3, subState4: SubState4) -> Result): Flow<Result>(source)

Select four sub-states from the source Flow and combine them into a Result.

The projector will be invoked only when one of the sub-states is changed. The returned flow will emit the result of projector, and all subsequent results repetitions of the same value are filtered out (same as distinctUntilChanged).

Parameters

selector1

The first selector to be used to select first sub-states.

selector2

The second selector to be used to select second sub-states.

selector3

The third selector to be used to select third sub-states.

selector4

The fourth selector to be used to select fourth sub-states.

projector

The projector to be used to combine the sub-states into a result.


fun <State, SubState1, SubState2, SubState3, SubState4, SubState5, Result> Flow<State>.select(selector1: Selector<State, SubState1>, selector2: Selector<State, SubState2>, selector3: Selector<State, SubState3>, selector4: Selector<State, SubState4>, selector5: Selector<State, SubState5>, projector: suspend (subState1: SubState1, subState2: SubState2, subState3: SubState3, subState4: SubState4, subState5: SubState5) -> Result): Flow<Result>(source)

Select five sub-states from the source Flow and combine them into a Result.

The projector will be invoked only when one of the sub-states is changed. The returned flow will emit the result of projector, and all subsequent results repetitions of the same value are filtered out (same as distinctUntilChanged).

Parameters

selector1

The first selector to be used to select first sub-states.

selector2

The second selector to be used to select second sub-states.

selector3

The third selector to be used to select third sub-states.

selector4

The fourth selector to be used to select fourth sub-states.

selector5

The fifth selector to be used to select fifth sub-states.

projector

The projector to be used to combine the sub-states into a result.