Created
June 20, 2019 18:56
-
-
Save ceruleanotter/00315271d8dd3c396fa9d7a52c7ad6bd to your computer and use it in GitHub Desktop.
ViewModel Integrations: LiveData & Saved State Module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// getLiveData gets MutableLiveData associated with a key. | |
// When the value associated with the key updates, the MutableLiveData does as well. | |
private val _userId : MutableLiveData<String> = savedStateHandle.getLiveData(USER_KEY) | |
// Only expose a immutable LiveData | |
val userId : LiveData<String> = _userId |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment