Skip to content

Instantly share code, notes, and snippets.

@PatilShreyas
Last active June 23, 2022 13:15
Show Gist options
  • Save PatilShreyas/84635b3d92623b1584115848d0c98f28 to your computer and use it in GitHub Desktop.
Save PatilShreyas/84635b3d92623b1584115848d0c98f28 to your computer and use it in GitHub Desktop.
private val isLoading = MutableStateFlow(false)
private val loggedInUser = MutableStateFlow<User?>(null)
private val error = MutableStateFlow<String?>(null)
// Combining these states to form a LoginState
val state: StateFlow<LoginState> = combineStates(
isLoading,
loggedInUser,
error
) { loading, user, errorMessage ->
LoginState(loading, user, errorMessage)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment