3

I have a List<Item> that I want to be displayed using Jetpack Compose. In version "1.0.0-alpha10", this code:

@Composable
fun ItemsScreen(items: List<Item>) {
    item?.let {
        LazyColumn {
            items(
                    items = items
            ) { item ->
                ItemCard(item = item)
            }
        }
    }
}

Works fine, but, starting with "1.0.0-alpha11", according to the new updates:

New items(count: Int) factory method for scope of LazyColumn/LazyRow/LazyVerticalGrid. items(items: List) and itemsIndexed(items: List) are now extension functions so you have to manually import them when used.

My app doesn't work any more. I'm not sure I understand:

items(items: List) are now extension functions so you have to manually import.

What does it mean? How to solve this issue?

Thanks in advance.

Joan P.
  • 2,368
  • 6
  • 30
  • 63

1 Answers1

5

You need to add this import for the extension function LazyListScope.items():

import androidx.compose.foundation.lazy.items
Saurabh Thorat
  • 18,131
  • 5
  • 53
  • 70