Skip to content

Instantly share code, notes, and snippets.

@tunjid
Created October 11, 2021 14:59
Show Gist options
  • Select an option

  • Save tunjid/de0ccc9c079a64c6625e90cea3e55bea to your computer and use it in GitHub Desktop.

Select an option

Save tunjid/de0ccc9c079a64c6625e90cea3e55bea to your computer and use it in GitHub Desktop.
class SearchRepositoriesViewModel(
) : ViewModel() {
val state: StateFlow<UiState>
val pagingDataFlow: Flow<PagingData<Repo>>
init {
pagingDataFlow = searches
.flatMapLatest { searchRepo(queryString = it.query) }
.cachedIn(viewModelScope)
state = combine(...)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment