ItemScreenData
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:
Route composable observes ItemViewModel.itemUiState which wraps this data class
Form fields bind to jetpackName and jetpackPrice with two-way data flow
Save button triggers ItemViewModel.createOrUpdateJetpack which sets navigateBack
Navigation observer consumes navigateBack event to pop the back stack
Parameters
Unique identifier for the Jetpack item (UUID for new items).
Display name of the Jetpack library (e.g., "Compose", "Room").
Price value for the Jetpack library.
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