Navigation Compose Error : " cannot be found in the navigation graph ComposeNavGraph(0x0) "

27 views Asked by At

I'm passing object of Student to StudentPage with Gson this is NavGraph file

composable(
            Screen.StudentPage.route, arguments = listOf(
            navArgument("studentObject") {
                type = NavType.StringType
            }
        )) {
            val studentObject = it.arguments?.getString("studentObject")
            val json = Gson().fromJson(studentObject, Student::class.java)
            StudentPage(navController = navController, json)
        }

This is class where I'm passing

val studentJson = Gson().toJson(studentObject)
                            navController.navigate(Screen.StudentPage.passNavigate(studentJson))

This is my error :

java.lang.IllegalArgumentException: Navigation destination that matches request NavDeepLinkRequest{ uri=android-app://androidx.navigation/studentPage/{"id":"0e83f952-8d13-40c0-b53c-d6354b92cebd","student_AGNO":"3.44","student_ID":"40159701816","student_address":"Cankaya / Ankara","student_age":"18","student_classLevel":"3","student_department":"Bilgisayar Mühendisliği Default","student_faculty":"Teknoloji Fakültesi","student_info":"Gazi Üniversitesi Bilgisayar Mühendisliği Bölümü 3. sınıf öğrencisi Kadir Özer Öztürk.\n\n","student_mail":"","student_name":"Kadir Özer Öztürk","student_no":"21181616039","student_password":"","student_phone":"5456577727","student_workPlace":"3"} } cannot be found in the navigation graph ComposeNavGraph(0x0) startDestination={Destination(0xc4c186b8) route=entryPageSelection}

I tried to do with just student No it2S working but I want to pass object as json.

0

There are 0 answers