Android, Jetpack, Jetpack Datastore.
currentPrefs.copy(email = newEmail) } else { currentPrefs } } } suspend fun incrementLoginCount(dataStore: DataStore<AppState>) { dataStore.update { currentAppState -> currentAppState.copy(loginCount = currentAppState.loginCount + 1) } } Explanation: updateEmailIfLoggedIn conditionally updates