@Composable invocations can only happen from the context of a @Composable function
s
Stylianos Gakis
11/08/2024, 2:01 PM
Copy code
LazyColumn() {
item { HereGoesYourFirstExtraItem() }
//whatever you had before anyway
//items(...).... or whatever
}
➕ 2
m
mattinger
11/08/2024, 4:17 PM
What @Stylianos Gakis put is correct. Just an explanation: LazyColumn deliberately DOES NOT take a composable lamba like Column does. As a result, you cannot directly add composables to it.
Basically, due to the laziness, it needs you to give it lambda functions which will produce your composable output, instead of directly producing your composable output.
That's what the "item", "items" and "stickyHeader" functions do, is they register a lambda function with the control telling it how to produce a particular item when it's needed.