sasikanth

    sasikanth

    2 years ago
    I am trying to use
    remember
    with
    mutableStateOf
    as a property delegate, but I am getting this error.
    Type 'TypeVariable(T)' has no method 'getValue(Nothing?, KProperty<*>)' and thus it cannot serve as a delegate
    Here is the usage
    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
    val selectedItem = remember { mutableStateOf(0) }
    Found the issue, I had to import
    import androidx.compose.runtime.setValue
    import androidx.compose.runtime.getValue
    for it to work
    It would have been great if the content actions showed that instead of option to create an extension 🤔