https://kotlinlang.org logo
#compose
Title
# compose
s

sasikanth

09/13/2020, 1:52 PM
I am trying to use
remember
with
mutableStateOf
as a property delegate, but I am getting this error.
Copy code
Type 'TypeVariable(T)' has no method 'getValue(Nothing?, KProperty<*>)' and thus it cannot serve as a delegate
Here is the usage
Copy code
var selectedItem by remember { mutableStateOf(0) }
Currently I am using AS 4.2 Canary 10 with Compose Alpha 02. Am I doing something wrong or is this an issue?
If I replace it with this, it works fine
Copy code
val selectedItem = remember { mutableStateOf(0) }
Found the issue, I had to import
Copy code
import androidx.compose.runtime.setValue
import androidx.compose.runtime.getValue
for it to work
👍 1
It would have been great if the content actions showed that instead of option to create an extension 🤔
1
4 Views