class LendingViewModel : AndroidViewModel
Part of viewmodels.
LendingViewModel designed to store and manage UI-related data in a lifecycle conscious way. This allows data to survive configuration changes such as screen rotations. In addition, background work such as fetching network results can continue through configuration changes and deliver results after the new Fragment or Activity is available. It's also responsible for the removal of objects
Factory |
Factory for constructing LendingViewModel with parameter class Factory : Factory |
<init> |
AddLendingViewModel LendingViewModel(: Application, : String, : String) |
id |
: String the logged in user's id val id: String |
lending |
: the list of LendingObject that the user is sharing val lending: LiveData<List<LendingObject>> |
onCleared |
Cancel all coroutines when the ViewModel is cleared fun onCleared(): Unit |
removeObject |
fun removeObject(: LendingObject): Unit |
selectObject |
fun selectObject(: LendingObject?): Unit |