insertNotNull

fun <S, W : SimplePanel> W.insertNotNull(stateFlow: StateFlow<S?>, removeChildren: Boolean = true, runImmediately: Boolean = true, factory: SimplePanel.(S) -> Unit): SimplePanel(source)

An extension function which inserts child component and binds it to the given state flow when the state value is not null.

Parameters

S

the state type

W

the container type

stateFlow

the StateFlow instance

removeChildren

remove all children of the child component

runImmediately

whether to run factory function immediately with the current state

factory

a function which re-creates the view based on the given state


fun <S, T, W : SimplePanel> W.insertNotNull(stateFlow: StateFlow<S>, sub: (S) -> T?, removeChildren: Boolean = true, runImmediately: Boolean = true, factory: SimplePanel.(T) -> Unit): SimplePanel(source)

An extension function which inserts child component and binds it to the given state flow using the sub flow extractor when the state value is not null.

Parameters

S

the state type

T

the sub state type

W

the container type

stateFlow

the StateFlow instance

sub

an extractor function for sub flow

removeChildren

remove all children of the child component

runImmediately

whether to run factory function immediately with the current state

factory

a function which re-creates the view based on the given state