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

Fudge

07/21/2020, 7:12 PM
Why are
MutableState<T>.setValue
/
MutableState<T>.getValue
extension methods instead of instance methods? This creates some confusion for me when I write
by state{}
and it errors, and I need to use the import quickfix.
z

Zach Klippenstein (he/him) [MOD]

07/21/2020, 7:15 PM
https://developer.android.com/jetpack/androidx/releases/compose#0.1.0-dev09:
[Mutable]State property delegate operators moved to extensions to support Kotlin 1.4 property delegate optimizations. Callers must add imports to continue using by state { ... } or by mutableStateOf(...). (I5312c)
☝️ 1
a

Adam Powell

07/21/2020, 7:40 PM
Ideally we can get studio doing this in one step rather than several, but yeah, it's to benefit from the inlining in 1.4
l

Leland Richardson [G]

07/21/2020, 7:45 PM
yeah, plan on the IDE doing a better job w/ this at some point
🙏 1
but them being extension functions are actually pretty critical