0

So, I'm scratching my head to see why I cannot send arguments, this should be straight forward and I cannot do it, i'm getting an IllegalArgumentException: Navigation destination that matches request NavDeepLinkRequest cannot be found

My code is pretty simple

 composable(NavigationScreens.NewsScreen.route) {
 val urlLink = "http://www.google.com"
 NewsComposable(onClick = { navController.navigate("news_screen_web_view/${urlLink}") } )
}

composable(NavigationScreens.NewsScreenWebView.route,
            arguments = listOf(navArgument(NEWS_DETAIL_KEY) {
                type = NavType.StringType
            })
        ) { backStackEntry ->
            backStackEntry.arguments?.let { safeBundle ->
                safeBundle.getString(NEWS_DETAIL_KEY)?.let { LoadWebUrl(url = it) }
            }
        }

And here the sealed class

sealed class NavigationScreens(val route: String) {
    object NewsScreen : NavigationScreens("news_screen")
    object NewsScreenWebView : NavigationScreens("news_screen_web_view/{$NEWS_DETAIL_KEY}")

}

const val NEWS_DETAIL_KEY = "pageUrl"
SNM
  • 5,625
  • 9
  • 28
  • 77

0 Answers0