Hi, I am using MutableStateFlow in my jetpack comp...
# compose
k
Hi, I am using MutableStateFlow in my jetpack compose. Like below
Copy code
val isBluetoothEnabled = MutableStateFlow(false)
whenever I tried to use the value of variable like this
.value
i.e.
isBluetoothEnabled.value
. So I am trying to use delegate property to avoid using
.value
Copy code
val isBluetoothEnabled by MutableStateFlow(false)
but I am getting weird error
Copy code
Type 'MutableStateFlow<TypeVariable(T)>' has no method 'getValue(PairViewModel, KProperty<*>)' and thus it cannot serve as a delegate
m
Try to add this import statement:
Copy code
import androidx.compose.runtime.*
k
nothing works.
I think MutableStateFlow is
kotlinx.coroutines.flow
part not compose stuff.
m
k
okk got it
420 Views