【发布时间】:2022-12-01 23:17:32
【问题描述】:
In the following variables, how do I dynamically pass user.id and friend.id
class WindViewModel @Inject constructor() : BaseViewModel() {
val userWindList = Pager(config = pagingConfig, remoteMediator = WindRemoteMediator("userWindList", user.id, friend.id, database!!, api)) {
windRepository.pagingModelList(friend.id, "userWindList")
}.flow.map { pagingData ->
pagingData.map { it.json.toWind() }
}.cachedIn(viewModelScope)
}
【问题讨论】:
-
By dynamic, do you mean at the time viewModel is created ( like passing in the constructor) or during runtime?
标签: android kotlin android-viewmodel