Android Paging 3 library: how to change list with new param?
问题 I have a search fragment that shows list of searched items. if user type something, I pass that string to url as new query parameter and get new list using paging 3 library. first solution is: //viewModel lateinit var postListUrl: String val postList: Flow<PagingData<Post>> = Pager(PagingConfig(pageSize = 20)) { PostPagingSource(postRepository, postListUrl) }.flow.cachedIn(viewModelScope) //fragment fun showPostList(url: String) { postListAdapter.submitData(lifecycle, PagingData.empty())