No more String-based Routes! New Compose Navigation Release

  Рет қаралды 10,351

Stevdza-San

Stevdza-San

Күн бұрын

🏆 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
@StevdzaSan
@StevdzaSan 6 ай бұрын
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) ✅
@galaxiegalaxie5003
@galaxiegalaxie5003 6 ай бұрын
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.🥰
@StevdzaSan
@StevdzaSan 6 ай бұрын
@galaxiegalaxie5003 Oh yeah Voyager has a really nice API indeed 😊
@moaliyou
@moaliyou 6 ай бұрын
I'll wait to see the stable one, this is really amazing
@skarloti
@skarloti 6 ай бұрын
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.
@mehdiparsaei1867
@mehdiparsaei1867 2 ай бұрын
Thanks! I would suggest "sealed interface Screen"
@raja_uma1r
@raja_uma1r 6 ай бұрын
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.
@manofsteel6173
@manofsteel6173 6 ай бұрын
Bro I'm new to compose.can u provide any links to learn navigation
@LuckyFortunes-b3q
@LuckyFortunes-b3q 15 күн бұрын
@@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т
@ПавелЯкунин-й5т 6 ай бұрын
finally!!!! it was a giant pain in the ass for me! it's time for refactoring!!
@abdushakoor0099
@abdushakoor0099 6 ай бұрын
can't wait to test it out. it's been a long time especially because we already have type-safe in xml navigation
@MaggicBones
@MaggicBones 6 ай бұрын
me too !
@wilkq1110
@wilkq1110 3 ай бұрын
thank you for the video, Will be there more materials with new navigation? I'd appreciate that :) creating bottom bar nav etc
@LuckyFortunes-b3q
@LuckyFortunes-b3q 15 күн бұрын
kotlin is a spaghetti code goblin. Dozens of lines of code to do something simple as changing screens.
@heshamabdo6024
@heshamabdo6024 6 ай бұрын
your video is amazing. Thank you so much for sharing this new technology with us.
@jam-burger
@jam-burger 6 ай бұрын
Can you make a video about explaining all the effects (like LaunchEffect and all)
@DanielLopes-j6k
@DanielLopes-j6k Ай бұрын
Any example with NavigationBar?
@henrik908
@henrik908 6 ай бұрын
Thanks you for the video my friend.
@tusharsrivastava107
@tusharsrivastava107 6 ай бұрын
They are adding @Serializable and @Parcelable both to a class ? i was under impression parcelable can improve app performance over serilization.
@debiprasaddash654
@debiprasaddash654 2 ай бұрын
How to setup dependencies for type safe navigation in old android studio
@codeforandroid
@codeforandroid 6 ай бұрын
Nice update ✌
@Yang-Youtube
@Yang-Youtube 6 ай бұрын
The new safe args navigation doesn't seem to work with deeplink.😢
@vengateshm2122
@vengateshm2122 6 ай бұрын
I tried and faced the similar crash.
@4ytonly
@4ytonly 6 ай бұрын
I suggest you change the title of your video to include words navigation so its easier to find later!
@StevdzaSan
@StevdzaSan 6 ай бұрын
Thanks for the tip!
@Tbijo54
@Tbijo54 6 ай бұрын
Can we still get runtime args from SavedStateHandle in viewmodels?
@pitoszud
@pitoszud 2 ай бұрын
private val _id = MutableStateFlow(savedStateHandle.toRoute
@ahmetfarukcuha7793
@ahmetfarukcuha7793 6 ай бұрын
eventually :)
@TomBerghuis
@TomBerghuis 6 ай бұрын
Can you access the argument in the viewmodel?
@StevdzaSan
@StevdzaSan 6 ай бұрын
Yes, you can use SavedStateHandle and call the same toRoute() function within the ViewModel.
@sebastianseno9285
@sebastianseno9285 6 ай бұрын
it's also work with Parcelize ?
@imammihir
@imammihir 6 ай бұрын
Wow 🎉
@skarloti
@skarloti 6 ай бұрын
1:38 Is it possible to replace its sealed class Screen with a sealed interface Screen?
@StevdzaSan
@StevdzaSan 6 ай бұрын
Haven't used sealed interface that much at all.
@pyaesonehan19
@pyaesonehan19 5 ай бұрын
@abobus_f1
@abobus_f1 6 ай бұрын
Can you say what the better this navigation or voyager
@StevdzaSan
@StevdzaSan 6 ай бұрын
Ah, you're asking hard questions 😄
@abobus_f1
@abobus_f1 6 ай бұрын
@@StevdzaSan😄
@Klusio19
@Klusio19 6 ай бұрын
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 😅
@StevdzaSan
@StevdzaSan 6 ай бұрын
I'll also update the course with this new approach, I'm waiting for a beta release just in case. :)
@abhilashpatel6852
@abhilashpatel6852 3 ай бұрын
​@@StevdzaSanhave you updated in udemy? I am thinking of checking it out
@Nick-cx4rs
@Nick-cx4rs 6 ай бұрын
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
@StevdzaSan
@StevdzaSan 6 ай бұрын
Bugs are gonna be always present. I've never had any issue with their basic components. On what exactly are you referring to?
@Nick-cx4rs
@Nick-cx4rs 6 ай бұрын
​@@StevdzaSan e.g. disable swipe on bottomsheet. Put scrollable layout in it .bottomSheet closing on swipe. m3
@KingFuYouTube
@KingFuYouTube 6 ай бұрын
first
@srkrishnan1989
@srkrishnan1989 6 ай бұрын
Try flutter and make difference video
@sudheeshmohan4357
@sudheeshmohan4357 5 ай бұрын
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()
@javiergonzalez399
@javiergonzalez399 4 ай бұрын
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) } }
LazyColumn - Forget about RecyclerView Adapter - Jetpack Compose
10:32
Everything you need to know about Kotlin 2.0 🟣
11:05
Stevdza-San
Рет қаралды 68 М.
ТЮРЕМЩИК В БОКСЕ! #shorts
00:58
HARD_MMA
Рет қаралды 2,5 МЛН
Hoodie gets wicked makeover! 😲
00:47
Justin Flom
Рет қаралды 131 МЛН
Can You Find Hulk's True Love? Real vs Fake Girlfriend Challenge | Roblox 3D
00:24
ТЫ В ДЕТСТВЕ КОГДА ВЫПАЛ ЗУБ😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 4,4 МЛН
Master IAM Users, Groups, and Role in AWS | Part 3.b
42:02
ANIL KUMAR PATEL
Рет қаралды 2
Navigation Compose meet Type Safety
16:50
Android Developers
Рет қаралды 15 М.
Navigation Basics in Jetpack Compose
14:40
Stevdza-San
Рет қаралды 67 М.
Bottom Navigation with Jetpack Compose
15:29
Stevdza-San
Рет қаралды 54 М.
Kotlin Multiplatform vs Flutter: Which should we use?
4:42
Kei Fujikawa
Рет қаралды 26 М.
Type-Safe Navigation with the OFFICIAL Compose Navigation Library
10:03
Jetpack compose navigation - arguments
24:41
Land of coding
Рет қаралды 1,1 М.
ТЮРЕМЩИК В БОКСЕ! #shorts
00:58
HARD_MMA
Рет қаралды 2,5 МЛН