Pedro Francisco de Sousa Neto
07/22/2025, 12:40 AMSavedStateHandle
in a @KoinViewModel
injected in a composable
function?
Version
koin-bom = "4.1.0"
koin-annotations = "2.1.0"
kotzilla = "1.2.0-Beta1"
kotzillaPlugin = "1.2.0-Beta2"
Caused by: org.koin.core.error.NoDefinitionFoundException: No definition found for type 'androidx.lifecycle.SavedStateHandle'. Check your Modules configuration and add missing type and/or qualifier!
When I remove the SavedStateHandle
from my ViewModel, everything works fine.Kibet Theophilus
07/22/2025, 7:35 AMarnaud.giuliani
07/22/2025, 11:56 AMPedro Francisco de Sousa Neto
07/22/2025, 2:36 PM@KoinViewModel
class MyViewModel(
private val getUsers: GetUsers,
private val savedStateHandle: SavedStateHandle
) : ViewModel(), StateMachine<UserListIntent, UserListState>
Compose
@Composable
fun MyScreen(
viewModel: MyViewModel = koinInject(),
) {
val state by viewModel.state.collectAsState()
LaunchedEffect(Unit) {
viewModel.dispatch(UserListIntent.LoadUsers)
}
[...]
}
arnaud.giuliani
07/22/2025, 2:36 PMPedro Francisco de Sousa Neto
07/22/2025, 2:36 PMarnaud.giuliani
07/22/2025, 2:37 PMPedro Francisco de Sousa Neto
07/22/2025, 2:50 PM