Does Jetpack Compose automatically generate keys for LazyColumn items?
0 reputation · 13 Nov 2025, 20:04 UTC
I am working with Jetpack Compose 1.4 or later and need to understand whether the framework can infer stable keys for items in a LazyColumn or LazyRow when the underlying list is reordered or filtered. The documentation indicates that explicit keys are required to avoid unintended recompositions, but it is unclear whether any automatic key inference exists for common data types or whether the responsibility always rests with the caller.
This matters because missing keys can cause excessive recomposition and may interfere with state restoration across configuration changes or back-stack navigation. I am looking for confirmation of the current contract and any version-specific exceptions before deciding whether to add keys manually.
Does Compose generate implicit keys for Lazy list items, or must every item key be supplied explicitly? Are there collection types or item layouts where automatic keying is safe to rely on?