Challenge 1: A Preferences DataStore Setting — Solution val Context.dataStore: DataStore by preferencesDataStore(name = "app_settings") object PreferencesKeys { val NOTIFICATIONS_ENABLED = booleanPreferencesKey("notifications_enabled") } fun getNotificationsEnabled(context: Context): Flow = context.dataStore.data.map { prefs -> prefs[PreferencesKeys.NOTIFICATIONS_ENABLED] ?: true } suspend fun setNotificationsEnabled(context: Context, enabled: Boolean) { context.dataStore.edit { prefs -> prefs[PreferencesKeys.NOTIFICATIONS_ENABLED] = enabled } } Notes: - prefs[PreferencesKeys.NOTIFICATIONS_ENABLED] ?: true uses the Elvis operator (Kotlin Fundamentals Chapter 3) — since the key genuinely might not exist yet (e.g. the very first time the app runs before any write has happened), the fallback default (true, meaning notifications are on by default) covers that case cleanly. - context.dataStore.data is a Flow — .map { } transforms it into a Flow focused on just this one setting, using Kotlin Intermediate Chapter 2's Flow operators. - setNotificationsEnabled is a suspend function, since dataStore.edit { } itself suspends — it can only be called from a coroutine, not directly from, say, a Button's onClick lambda without wrapping it in a launch.