core-ktx: It is impossible to use shared preferences delegates in local variables
Closed this issue · 1 comments
rwqwr commented
It is not possible to use delegates in local variables.
fun changeValue(newValue: String) {
var value: String by preferences.string("key")
value = newValue
println(value)
}
The reason is the use of a non-null object type to which the delegated property belongs, i.e. T
generic type in the ReadWriteProperty
class. I noticed this in the core extensions, but it might be appropriate in other delegates as well. If you want, I can create a MR with the fixes.
osipxd commented
MR is welcome!