Stabile und instabile Parameter
Verstehen Sie, wodurch Composables übersprungen werden können.
Stabile und instabile Parameter ist eine kostenlose Jetpack Compose Academy-Lektion auf CoddyKit. Dies ist Lektion 1 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des Jetpack Compose Academy-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der Jetpack Compose Academy-Kurs umfasst insgesamt 4 Lektionen.
Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.
What Skipping Means
When a Composable re-runs but its inputs have not changed, Compose can skip it entirely. Skipping is how fast Compose apps stay fast. 🚀
Stability Decides Skipping
Compose only skips a Composable when every parameter is stable. One unstable input and the whole function re-executes on each recomposition.
What "Stable" Promises
A type is stable when Compose trusts that equals() is reliable and that public properties will not change without telling Compose.
Naturally Stable Types
Primitives, String, and function types are stable out of the box, so passing an Int or a lambda never blocks skipping.
fun Greeting(name: String, count: Int) {
Text("Hello $name x$count")
}val Properties Are Stable
A class with only val properties of stable types is itself stable. Immutable data is the friendliest input you can give Compose.
data class User(val id: Int, val name: String)var Makes a Type Unstable
A mutable var property can change behind Compose's back, so the class becomes unstable and its Composable can no longer skip.
data class Counter(var value: Int)Collections Look Unstable
Plain List, Map, and Set are treated as unstable, because the interface could hide a mutable ArrayList underneath.
fun ItemRow(items: List<String>) { }Why Interfaces Worry Compose
An interface parameter is unstable: the concrete implementation is unknown at compile time, so Compose cannot guarantee its equals() behaves.
Strong Skipping Mode
Newer Compose ships strong skipping, which lets unstable parameters compare by reference, so many cases skip without extra annotations.
Spotting Unstable Inputs
If a Composable redraws every frame for no visible reason, suspect an unstable parameter forcing a full re-run each time.
Stability Is About Trust
Stability is a promise to Compose, not magic. The more immutable your inputs are, the more work Compose is free to skip.
Quick Check
Test your grasp of stability.
Recap: Stable Wins
Compose skips a Composable only when every input is stable. Favor primitives, Strings, and val-only classes to keep redraws cheap. ✅
Häufig gestellte Fragen
Ist die Lektion „Stabile und instabile Parameter“ kostenlos?
Ja — der vollständige Text von „Stabile und instabile Parameter“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des Jetpack Compose Academy-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der Jetpack Compose Academy-Kurs umfasst insgesamt 4 Lektionen.
Was lerne ich in „Stabile und instabile Parameter“?
Verstehen Sie, wodurch Composables übersprungen werden können. Du übst Jetpack Compose Academy mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.
Brauche ich Erfahrung, um Jetpack Compose Academy zu starten?
Keine Vorkenntnisse erforderlich. Jetpack Compose Academy auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 1 von 4.
Wie lange dauert die Lektion „Stabile und instabile Parameter“?
Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.
Kann ich in dieser Jetpack Compose Academy-Lektion Code schreiben und ausführen?
Ja. Jede Jetpack Compose Academy-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.
Alle Lektionen in diesem Kurs
- Stabile und instabile Parameter
- Überspringen, @Stable und @Immutable
- State-Lesevorgänge verzögern
- Layout Inspector und Recomposition-Zähler