Skip to content

Instantly share code, notes, and snippets.

@Nimrodda
Created March 19, 2019 11:28
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 Nimrodda/784733e3c7fce03f7ca43c4d6e5e31bf to your computer and use it in GitHub Desktop.
Save Nimrodda/784733e3c7fce03f7ca43c4d6e5e31bf to your computer and use it in GitHub Desktop.
class DetailViewModel @Inject constructor(
private val githubApi: GithubApi,
private val handle: SavedStateHandle
) : ViewModel() {
fun loadData() {
val id = handle["id"] ?: "default"
viewModelScope.launch {
val response = githubApi.getCommit(id)
// Handle response
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment