ItemScreenData

data class ItemScreenData(val jetpackId: String = UUID.randomUUID().toString(), val jetpackName: String = "", val jetpackPrice: Double = 0.0, val navigateBack: OneTimeEvent<Boolean> = OneTimeEvent(false))

Immutable data class representing the state of the create/edit item form.

This class manages form state for both creating new Jetpack items and editing existing ones. When creating a new item, jetpackId is pre-populated with a random UUID. When editing, the ID and other fields are loaded from the repository via ItemViewModel.getJetpack.

The navigateBack event is triggered after a successful create/update operation and is consumed by the Route composable to navigate back to the home screen. Being wrapped in OneTimeEvent ensures the navigation only happens once, even if the state is re-emitted.

Usage context:

Parameters

jetpackId

Unique identifier for the Jetpack item (UUID for new items).

jetpackName

Display name of the Jetpack library (e.g., "Compose", "Room").

jetpackPrice

Price value for the Jetpack library.

navigateBack

One-time event to trigger back navigation after successful save.

See also

ViewModel that manages this screen data

Wrapper providing loading and error state

Ensures events are consumed only once

Domain model created from this form data

Constructors

Link copied to clipboard
constructor(jetpackId: String = UUID.randomUUID().toString(), jetpackName: String = "", jetpackPrice: Double = 0.0, navigateBack: OneTimeEvent<Boolean> = OneTimeEvent(false))

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard