Open uDanielBispo opened 3 months ago
Maybe this is because you're initializing it inside a Composable
function.
It'll work with no errors if you initialize it in a not-composable one, otherwise, you'll need to do it with the remember
function.
PS: You might want to take a look at Understanding state in Compose from Interacting with UI and State pathway.
URL of codelab https://developer.android.com/codelabs/basic-android-kotlin-compose-using-state?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-2-pathway-3%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-using-state#4
In which task and step of the codelab can this issue be found? Intro to state in Compose
Describe the problem Hi! I do not really know if it is a problem, however I was following the step by step of this process and I have found a litlle problem:
In the codelab it says that you can use this code, but I got an error that prevented me to build the app, may be something that changed in the mean time that the codelab was created and I have satarted, anyway if it is not a problem, ok.
I already tried to use
.value
, still not workingI expect being useful
Steps to reproduce?
Versions Android Studio version: sorry, i am new on this, can't say API version of the emulator: sorry, i am new on this, can't say
Additional information Include screenshots if they would be useful in clarifying the problem.