0Pricing
Kotlin Multiplatform Academy · Lesson

Defaults & Clearing Keys

Handle missing values and reset state cleanly.

Missing Keys Happen

On a fresh install, no keys exist yet. How your code handles a missing value decides whether the app feels solid or crashes. 🛟

Defaults to the Rescue

The plain getters take a default you supply. If the key is absent, you get that fallback instead of an error.

val theme = settings.getString("theme", "light")

All lessons in this course

  1. Why a Settings Abstraction
  2. Read & Write Typed Values
  3. Defaults & Clearing Keys
  4. Store an Auth Token Securely
← Back to Kotlin Multiplatform Academy