allan.conda
stateDelegate
// util inline operator fun <T> StateFlow<T>.getValue(thisObj: Any?, property: KProperty<*>): T = value inline operator fun <T> MutableStateFlow<T>.setValue(thisObj: Any?, property: KProperty<*>, value: T) { this.value = value } // usage private val stateDelegate: MutableStateFlow = MutableStateFlow(...) private var _state: State = stateDelegate val state: StateFlow<State> = stateDelegate fun foo() { _state = State(...) }
A modern programming language that makes developers happier.