So, I need to run some code inside a LaunchedEffect.
First I wanted to use a Boolean, but once I set it to true, the LaunchedEffect block wasn’t triggered again. I tried to set the value to null, before I set it to true again, but it didn’t work as well.
Now I simple set it to Int type, and if I increase the value by 1 every time, it works as expected.
I used like this:
val boolState = remember {
mutableStateOf<Boolean?>(null)
}
LaunchedEffect(key1 = boolState.value) {
if(boolState.value == true){
//Do something
}
}
So my question is, what should I use as a key, to be able to update any time?