<Custom onClickFlow{} vs dedicated MutableStateFlo...
# forum
r
Custom onClickFlow{} vs dedicated MutableStateFlow and CoroutineScope To prevent the usage of a dedicated MutableStateFlow in combination with a CoroutineScope to handle onClick:()->Unit callbacks, I created an onClickFlow{ emit(...) } to simplify and inline click handling. The logic behind the onClickFlow allows the emission of values to the outer flow collector as soon as the returned onClick-lambda is called. First the usage: data class State( val message: String, val onClickUpload: (() -> Unit)? = null, val onClickVerify: (() -> Unit)? = null,...