selectItem

fun selectItem(itemToSelect: Flow<T>, data: CollectionData<T>)

This function connects some Flow of T with a defined selection, either for single or multi mode.

Whenever a new value appears on the flow, this value will be used to update the selection for the following two cases:

  • if the value is already part of the selection, it will be removed

  • if not it will be used (single) as or added (multi) to the selection.

Parameters

itemToSelect

a Flow of a single T which should update the selection