:feature:home

Purpose: The template's reference feature — a Jetpack list with create/edit/delete, offline support, and background sync. The one feature the Guide walks through end to end.

Key APIs

APIWhat it does
HomeScreen / HomeViewModelJetpack list and swipe-to-delete; no undo action is implemented
ItemScreen / ItemViewModelCreate/edit a single jetpack; assisted-injected with the Nav3 itemId argument

Destination signature excerpt; imports and function body are omitted.

// feature/home/src/main/kotlin/dev/atick/feature/home/ui/item/ItemScreen.kt
@Composable
internal fun ItemScreen(
itemId: String?,
onBackClick: () -> Unit,
onShowSnackbar: suspend (String, SnackbarAction, Throwable?) -> Boolean,
// Navigation 3 passes destination arguments through the NavKey rather than a
// SavedStateHandle, so the id is handed to the ViewModel by assisted injection.
itemViewModel: ItemViewModel = hiltViewModel<ItemViewModel, ItemViewModel.Factory>(
creationCallback = { factory -> factory.create(itemId) },
),
)

Current limitations

Home and Item can accumulate repository collectors after resubscription while their ViewModels remain alive. Item currently ignores a failed save Result and can navigate back; its load catch does not store the error. See subscription lifetimes and the feature walkthrough for the current behavior and instructional alternatives. A local write does not acknowledge remote delivery.

Related Documentation

  • Guide — full walkthrough of this feature's ViewModel, screen, and navigation entries

  • State Management — UiState/StatefulComposable pattern used here

  • Navigation — assisted-inject ViewModels for keyed Nav3 arguments

  • Data Layer — the HomeRepository this feature reads/writes through

Packages

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