ItemScreenData

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

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, ItemScreenData.jetpackId is pre-populated with a random UUID. When editing, the ID and other fields are loaded from the repository via getJetpack().

The ItemScreenData.navigateBack event is set after the save call returns, including a returned failure. ItemScreen consumes it inside an effect. Consumption is at most once per event instance and does not acknowledge completed navigation.

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 exactly as typed, kept as text so a partially entered or cleared value survives; parsed to a Double only when the item is saved.

navigateBack

Consumable request to navigate back after the save call returns.

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: String = "", navigateBack: OneTimeEvent<Boolean> = OneTimeEvent(false))

Properties

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