How would you implement a search using Paging3 I’v...
# android
p
How would you implement a search using Paging3 I’ve tried resubscribing to the paging source , but the result isn’t very good
google 3
d
Generally you should do it in a flow based way
Copy code
queryFlow.flatMap { query ->
  Pager(..) {
    PagingSource(query)
  }
}.cachedIn(viewModelScope)
If you want to pass it to combine instead for say filter:
Copy code
Pager(..) { .. }
  .cachedIn(viewModelScope)
  .combine(queryFlow) { query, pagingData ->
pagingData.filter { ... }
}