Kotlin

Table of Contents

1. Trailing Lambda

The last parameter of a function can be provided in the curly braces, if it accepts lambda function.

Scaffold(
    topBar = { TopAppBar(title = { Text("Title") }) },
    content = { innerPadding ->
        Text("Hello")
    }
)

is equivalent to:

Scaffold(
    topBar = { TopAppBar(title = { Text("Title") }) }
) { innerPadding ->
    Text("Hello")
}

Author: Jeemin Kim

Created: 2026-09-29 Tue 00:17