alex22
1
Would be nice to have any Object and Map destructuring declaration (Like in TypeScript) translated into
val (name, age) = map
val name = person["name"]!!
val age = person["age"]!!
Or maybe use val { name, age } = map
if it’s needs to be distinguished from componentN
destructuring.
1 Like
wdoker
2
You can use local delegated properties:
val map = mapOf(
"name" to "John Doe",
"age" to 25
)
val name: String by map
val age: Int by map
https://kotlinlang.org/docs/reference/delegated-properties.html#storing-properties-in-a-map
2 Likes
alex22
3
Would it work for such case as one-line assigning property to local variable?
val { request_id } = result
versus
val request_id = result.request_id