Skip to content

Instantly share code, notes, and snippets.

@ChristopherME
Created May 26, 2021 01:43
Show Gist options
  • Save ChristopherME/c9b9603461fdfc693e8309872c8b3ad5 to your computer and use it in GitHub Desktop.
Save ChristopherME/c9b9603461fdfc693e8309872c8b3ad5 to your computer and use it in GitHub Desktop.
@HiltViewModel
class ProductDetailViewModel @Inject constructor(
private val savedStateHandle: SavedStateHandle,
...
) : ViewModel() {
...
private fun getProductFromArgs(): ProductDetailArgs {
return ProductDetailArgs(
productId = savedStateHandle.get("productId")?:"",
productParentId = savedStateHandle.get("productParentId")
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment