Is there any possibility that we don't need to import
State.getValue
and
MutableState.setValue
?
j
jw
11/16/2022, 12:19 AM
You could not use
by
and read/write to the
value
property
l
Loney Chou
11/16/2022, 10:01 AM
I don't understand?
j
james
11/16/2022, 11:31 AM
let’s say you have a variable named
input
instead of using:
var input by remember { mutableStateOf(…) }
and directly reading/writing to
input
you could have:
val input = remember { mutableStateOf(…) }
and you could read and write to
input.value
l
Loney Chou
11/16/2022, 1:26 PM
No I'm wondering why we need to import these two functions when it's more convenient if the official includes them as they are used a lot. So I'm imagining this:
Copy code
interface State<T> {
val value: T
operator fun getValue(/* ... */): T = value
}
'Cause sometimes IDEA just doesn't recognise when you