hawklike
12/05/2024, 2:56 PMRoute …CharacterDetail could not find any NavType for argument id of type …Character.Id - typeMap received was {}
For better perspective see the code:
@Serializable
public data class CharacterDetail(val id: Character.Id)
composable<CharacterDetail> { backStackEntry ->
val character: CharacterDetail = backStackEntry.toRoute()
CharacterDetailScreen(character.id, onNavigateBack)
}
public data class Character(id: Character.Id, ...) {
@Serializable
public data class Id(val value: Int)
}
Is the @Serializable type safe navigation argument still not supported in CMP?Ian Lake
12/05/2024, 3:12 PMCharacter.Id class. You need to do that if any of the fields in your class aren't primitive typesIan Lake
12/05/2024, 3:13 PMhawklike
12/05/2024, 3:19 PM@Serializable
public data class Id(val value: Int)
There is only a primitive type inside Character.Id class. What I am missing, please?
Also, I know a value class would be a perfect match for this use case, but we had some problems using them from the iOS side, so we abandoned them.Ian Lake
12/05/2024, 3:24 PMhawklike
12/05/2024, 3:26 PMGiovanni Marques
10/17/2025, 6:01 PMorg.jetbrains.androidx.navigation:navigation-compose:2.9.1 and when I navigate I get
java.lang.IllegalArgumentException: Navigation destination that matches route com.test.compose.Search/{"searchQuery":"test","filters":[""]} cannot be found in the navigation graph ComposeNavGraph(0x0) startDestination={Destination(0x56174464) route=com.test.compose.NavigationDestination.Home}
That’s how I registered the route
NavHost(
navController = navController,
startDestination = NavigationDestination.Home,
modifier = Modifier.weight(1f)
) {
...
composable<Search>(
typeMap = mapOf(typeOf<SearchParameters>() to SearchParametersType)
) { backStackEntry ->
val searchParameters = backStackEntry.toRoute<Search>().parameters
Text("Testing: $searchParameters")
}
}Giovanni Marques
10/17/2025, 6:03 PMtypeMap I get the expected error that it can't find the NavType for argument parameters of type SearchParameters, but if I declare the nav type it opens the app, correctly call the the methods on my custom NavType, but crashes saying that it couldn’t find the destination when I try to navigateIan Lake
10/17/2025, 6:28 PMserializeAsValue resultGiovanni Marques
10/20/2025, 10:27 AMput method was empty, I had forgotten to add the value to the bundle.