# SingleSelector

class SingleSelector < T >(selectedItem: T ? = null, safeChanges: Boolean = true) : Selector < T > (source)

Realization of Selector with one or without selected element. This realization will always have empty selectedItems when nothing selected and one element in selectedItems when something selected. Contains selectedItem value for simple access to currently selected item.

On calling of toggleSelection previous selection will be erased and itemUnselected will emit this element.

#### Parameters

safeChanges

Set to false to disable using of mutex for synchronizing changes on toggleSelection

## Constructors

SingleSelector
Link copied to clipboard
constructor(selectedItem: T ? = null, safeChanges: Boolean = true)

## Properties

itemSelected
Link copied to clipboard
open override val itemSelected : SharedFlow< T >
itemUnselected
Link copied to clipboard
open override val itemUnselected : SharedFlow< T >
selectedItem
Link copied to clipboard
var selectedItem : T ?
selectedItems
Link copied to clipboard
open override val selectedItems : List < T >

## Functions

clearSelection
Link copied to clipboard
open suspend override fun clearSelection ()
contains
Link copied to clipboard
inline operator fun < T > Selector < T >. contains (element: T ): Boolean
forceDeselect
Link copied to clipboard
open suspend override fun forceDeselect (element: T )
forceDeselect
Link copied to clipboard
inline suspend fun < T > Selector < T >. forceDeselect (elements: List < T >)
inline suspend fun < T > Selector < T >. forceDeselect (firstElement: T , vararg elements: T )
forceSelect
Link copied to clipboard
open suspend override fun forceSelect (element: T )
forceSelect
Link copied to clipboard
inline suspend fun < T > Selector < T >. forceSelect (elements: List < T >)
inline suspend fun < T > Selector < T >. forceSelect (firstElement: T , vararg elements: T )
itemSelectionFlow
Link copied to clipboard
fun < T > Selector < T >. itemSelectionFlow (element: T , scope: CoroutineScope): SharedFlow< Boolean >
nothingSelected
Link copied to clipboard
inline fun < T > Selector < T >. nothingSelected (): Boolean
toggleSelection
Link copied to clipboard
open suspend override fun toggleSelection (element: T )
toggleSelection
Link copied to clipboard
inline suspend fun < T > Selector < T >. toggleSelection (elements: List < T >)
inline suspend fun < T > Selector < T >. toggleSelection (firstElement: T , vararg elements: T )