I was wondering if it is better to use directly "content = {}" parameter instead of "{}" despite I see more often people using "{}".
Is the code cleaner or does the code load faster by using one or the other ? Is there any good practice ?
When using "{}"
@Composable
fun MyComposable(){
Box{}
}
When using "content = {}"
@Composable
fun MyComposable(){
Box(content = {})
}
The concepts used here are Kotlin trailing lambda and Kotlin named arguments.
Kotlin named arguments
So, this can be written with named arguments,
like this
Kotlin trailing lambda
From the docs,
This implies,
and
are same.