Last active
September 5, 2019 16:44
-
-
Save psteiger/7c1b9d0c16075fd6c69e5d253431172e to your computer and use it in GitHub Desktop.
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
| class UsersViewModel : ViewModel() { | |
| private val usersSnapLiveData: LiveData<Resource<DataSnapshot>> by lazy { | |
| UsersSnapLiveData() | |
| } | |
| val usersLiveData: LiveData<Resource<HashMap<String, User>>> by lazy { | |
| usersSnapLiveData.mapLiveDataResource< | |
| DataSnapshot, // from | |
| HashMap<String, User> // to | |
| >(DataSnapshot::getTypedValue) // transformation function | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment