Skip to content

Instantly share code, notes, and snippets.

@LloydBlv
Created April 7, 2024 04:44
Show Gist options
  • Save LloydBlv/463c600cb882414f93359bbb5c2b42f8 to your computer and use it in GitHub Desktop.
Save LloydBlv/463c600cb882414f93359bbb5c2b42f8 to your computer and use it in GitHub Desktop.
Expose Immutable State
class RatesViewModel constructor(
private val ratesRepository: RatesRepository,
) : ViewModel() {
private val _state = MutableStateFlow(RatesUiState(isLoading = true))
val state: StateFlow<RatesUiState>
get() = _state.asStateFlow()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment