Skip to content

Instantly share code, notes, and snippets.

Last active June 23, 2022 12:12
What would you like to do?
data class PreferenceState(...)
data class MultiplePreferenceState(val preferences: List<PreferenceState>)
class Preferences {
fun getPreferenceState(key: String): StateFlow<PreferenceState> { ... }
// Note: Return type becomes Flow<> and not StateFlow<>
fun getMultiplePreferenceState(keys: List<String>): Flow<MultiplePreferenceState> {
val prefStateFlows = { getPreferenceState(it) }.toTypedArray()
return combine(*prefStateFlows) { prefStates: Array<PreferenceState> ->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment