🏆 My Online Courses stevdza-san.com 📝 Writing on Medium / stevdza-san ☕ Let's get a coffee. You're paying! :) ko-fi.com/stev... 💻 Github github.com/ste... 📸 Instagram / stevdza_san
Пікірлер: 53
@StevdzaSan6 ай бұрын
For a custom data type we should override one more function in the NavType to avoid that run-time exception: serializeAsValue() and just return Json.encodeToString(value) ✅
@galaxiegalaxie50036 ай бұрын
Wow ita great to see such features. Anyways i wish they could make similar implementation like voyager in jepack naviagation which is so easy to do.🥰
@StevdzaSan6 ай бұрын
@galaxiegalaxie5003 Oh yeah Voyager has a really nice API indeed 😊
@moaliyou6 ай бұрын
I'll wait to see the stable one, this is really amazing
@skarloti6 ай бұрын
You always find amazingly good content. Thanks for the effort you put into teaching us something new. My day is perfect when it starts with your videos. Thank you.
@mehdiparsaei18672 ай бұрын
Thanks! I would suggest "sealed interface Screen"
@raja_uma1r6 ай бұрын
I always use a navigation viewModel to hold the data( also complex objects) and then read it from the destination screen. Use enum classes to define routes to overcome typing errors. This approach with compose navigation works well in every scenario.
@manofsteel61736 ай бұрын
Bro I'm new to compose.can u provide any links to learn navigation
@LuckyFortunes-b3q15 күн бұрын
@@manofsteel6173 easier to learn from chatgpt or claude AI. A lot of the documentation has been confusing me. I think Im going to approach it by creating each of my screens in fragments and load the fragments with NavController.
@ПавелЯкунин-й5т6 ай бұрын
finally!!!! it was a giant pain in the ass for me! it's time for refactoring!!
@abdushakoor00996 ай бұрын
can't wait to test it out. it's been a long time especially because we already have type-safe in xml navigation
@MaggicBones6 ай бұрын
me too !
@wilkq11103 ай бұрын
thank you for the video, Will be there more materials with new navigation? I'd appreciate that :) creating bottom bar nav etc
@LuckyFortunes-b3q15 күн бұрын
kotlin is a spaghetti code goblin. Dozens of lines of code to do something simple as changing screens.
@heshamabdo60246 ай бұрын
your video is amazing. Thank you so much for sharing this new technology with us.
@jam-burger6 ай бұрын
Can you make a video about explaining all the effects (like LaunchEffect and all)
@DanielLopes-j6kАй бұрын
Any example with NavigationBar?
@henrik9086 ай бұрын
Thanks you for the video my friend.
@tusharsrivastava1076 ай бұрын
They are adding @Serializable and @Parcelable both to a class ? i was under impression parcelable can improve app performance over serilization.
@debiprasaddash6542 ай бұрын
How to setup dependencies for type safe navigation in old android studio
@codeforandroid6 ай бұрын
Nice update ✌
@Yang-Youtube6 ай бұрын
The new safe args navigation doesn't seem to work with deeplink.😢
@vengateshm21226 ай бұрын
I tried and faced the similar crash.
@4ytonly6 ай бұрын
I suggest you change the title of your video to include words navigation so its easier to find later!
@StevdzaSan6 ай бұрын
Thanks for the tip!
@Tbijo546 ай бұрын
Can we still get runtime args from SavedStateHandle in viewmodels?
@pitoszud2 ай бұрын
private val _id = MutableStateFlow(savedStateHandle.toRoute
@ahmetfarukcuha77936 ай бұрын
eventually :)
@TomBerghuis6 ай бұрын
Can you access the argument in the viewmodel?
@StevdzaSan6 ай бұрын
Yes, you can use SavedStateHandle and call the same toRoute() function within the ViewModel.
@sebastianseno92856 ай бұрын
it's also work with Parcelize ?
@imammihir6 ай бұрын
Wow 🎉
@skarloti6 ай бұрын
1:38 Is it possible to replace its sealed class Screen with a sealed interface Screen?
@StevdzaSan6 ай бұрын
Haven't used sealed interface that much at all.
@pyaesonehan195 ай бұрын
@abobus_f16 ай бұрын
Can you say what the better this navigation or voyager
@StevdzaSan6 ай бұрын
Ah, you're asking hard questions 😄
@abobus_f16 ай бұрын
@@StevdzaSan😄
@Klusio196 ай бұрын
Currently I'm taking Your course on Udemy ToDo App with Compose, and these string-based routes were strange to me. What a perfect time for this video to come out 😅
@StevdzaSan6 ай бұрын
I'll also update the course with this new approach, I'm waiting for a beta release just in case. :)
@abhilashpatel68523 ай бұрын
@@StevdzaSanhave you updated in udemy? I am thinking of checking it out
@Nick-cx4rs6 ай бұрын
Bro still basic ui components are (Experimental) and has bugs for 3 year still they dont care it ? And why they still making shitshow apis intead of fix experimentals and stable it. Imagine getting type safe arguments after 3 years.I really dont understand them
@StevdzaSan6 ай бұрын
Bugs are gonna be always present. I've never had any issue with their basic components. On what exactly are you referring to?
@Nick-cx4rs6 ай бұрын
@@StevdzaSan e.g. disable swipe on bottomsheet. Put scrollable layout in it .bottomSheet closing on swipe. m3
@KingFuYouTube6 ай бұрын
first
@srkrishnan19896 ай бұрын
Try flutter and make difference video
@sudheeshmohan43575 ай бұрын
Isnt it more convenient to convert custom object to Jsonstring and pass as string param then parse the 'Json to object instead of creating navtype boilerplate code? Pass Gson().toJson(yourModelClassObject) in string param, then for getting it use generic function: inline fun String?.parseJsonString(): T? { return try { this?.let { val type = object : TypeToken() {}.type Gson().fromJson(it, type) } } catch (e: JsonSyntaxException) { Log.i("Error", "Failed to parse JSON string: ${e.message}") null } } val screenA = it.toRoute() val data = screenA .jsonstring.parseJsonString()
@javiergonzalez3994 ай бұрын
val coverNavType = GenericNavType(Cover::class, Cover.serializer()) class GenericNavType( private val clazz: KClass, private val serializer: KSerializer ) : NavType(isNullableAllowed = false) { override fun put(bundle: Bundle, key: String, value: T) { bundle.putParcelable(key, value) } override fun get(bundle: Bundle, key: String): T? { return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { bundle.getParcelable(key, clazz.java) } else { @Suppress("DEPRECATION") bundle.getParcelable(key) } } override fun parseValue(value: String): T { return Json.decodeFromString(serializer, value) } override fun serializeAsValue(value: T): String { return Json.encodeToString(serializer, value) } }