Skip to content

Instantly share code, notes, and snippets.

@igorescodro
Last active June 9, 2025 22:40
Show Gist options
  • Save igorescodro/dfafcec2c882f5891889180a20e13769 to your computer and use it in GitHub Desktop.
Save igorescodro/dfafcec2c882f5891889180a20e13769 to your computer and use it in GitHub Desktop.
// Event.kt
sealed interface Event {
fun nextDestination(): Destination
data object OnBack : Event {
override fun nextDestination(): Destination = Destination.Back
}
}
// ShoppingEvent.kt
object PreferenceEvent {
data class OnItemClick(itemId: String) : Event {
override fun nextDestination(): Destination = ShoppingDestination.Details(itemId = itemId)
}
data object OnCartClick : Event {
override fun nextDestination(): Destination = ShoppingDestination.Cart
}
data object OnCheckoutClick : Event {
override fun nextDestination(): Destination = ShoppingDestination.Payment
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment