How beneficial is it to learn and understand Kotlin before proceeding to compose? This session tackles some key Kotlin features that compose UI framework uses to achieve a non-bloated API
axe Then chop down the tree Simple enough right? Sharpen The Axe If you want to use compose fully, understand Kotlin Then use compose You shall know Bliss! Understand Kotlin
data class Market(val name: String){ val list = mutableListOf<String>() fun buy()... fun sell()... fun previewMarket(block: List<String>.() -> Unit){ list.block() } } fun main() { val market = Market(name= "Nairobi") ... market.previewMarket { this: List<String> filter { it.length > 4 } println(this) } }
} if-else if-else is an expression and returns a value @Composable fun HelloWorld(isTrue: Boolean) { val value = if(isTrue) "this" else "that" Text(value) }
Icons.Rounded.KeyboardArrowUp else Icons.Rounded.ArrowDropDown val description = if(isTrue) "this" else "that" Icon(imageVector = icon, contentDescription = title) } desctructuring dismantle a value into various variables
if(isTrue) Pair(Icons.Rounded.KeyboardArrowUp, "this") else Pair(Icons.Rounded.ArrowDropDown, "that") Icon(imageVector = icon, contentDescription = title) } desctructuring dismantle a value into various variables