Skip to content

Instantly share code, notes, and snippets.

@EmmanuelGuther
Last active February 9, 2023 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EmmanuelGuther/86ecf39e259d525371b7f279ef4abb9a to your computer and use it in GitHub Desktop.
Save EmmanuelGuther/86ecf39e259d525371b7f279ef4abb9a to your computer and use it in GitHub Desktop.
Viewmodel-->
private var _data: Channel<PagingData<Event>> = Channel()
var data = _data.receiveAsFlow()
fun callApiExample(){
usecaseFoo... .collect{ _data.send(it)}
}
Fragment-->
lifecycleScope.launchWhenStarted {
repeatOnLifecycle(Lifecycle.State.STARTED) {
vm.data.collect { events ->
pageOne.data(events)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment