No more String-based Routes! New Compose Navigation Release

Sdílet
Vložit
  • čas přidán 8. 05. 2024
  • 🏆 My Online Courses
    stevdza-san.com
    ☕ Let's get a coffee. You're paying! :)
    ko-fi.com/stevdza_san
    💻 Github
    github.com/stevdza-san
    📸 Instagram
    / stevdza_san

Komentáře • 43

  • @StevdzaSan
    @StevdzaSan  Před měsícem +24

    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 Před měsícem

      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  Před měsícem

      @galaxiegalaxie5003 Oh yeah Voyager has a really nice API indeed 😊

  • @skarloti
    @skarloti Před měsícem +4

    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.

  • @moaliyou
    @moaliyou Před měsícem +2

    I'll wait to see the stable one, this is really amazing

  • @raja_uma1r
    @raja_uma1r Před měsícem +2

    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 Před měsícem

      Bro I'm new to compose.can u provide any links to learn navigation

  • @heshamabdo6024
    @heshamabdo6024 Před měsícem

    your video is amazing. Thank you so much for sharing this new technology with us.

  • @abdushakoor0099
    @abdushakoor0099 Před měsícem

    can't wait to test it out. it's been a long time especially because we already have type-safe in xml navigation

  • @user-gl8yw6yu2i
    @user-gl8yw6yu2i Před měsícem +3

    finally!!!! it was a giant pain in the ass for me! it's time for refactoring!!

  • @henrik908
    @henrik908 Před měsícem

    Thanks you for the video my friend.

  • @codeforandroid
    @codeforandroid Před měsícem

    Nice update ✌

  • @Klusio19
    @Klusio19 Před měsícem +1

    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  Před měsícem +2

      I'll also update the course with this new approach, I'm waiting for a beta release just in case. :)

  • @jam-burger
    @jam-burger Před měsícem

    Can you make a video about explaining all the effects (like LaunchEffect and all)

  • @tusharsrivastava107
    @tusharsrivastava107 Před měsícem

    They are adding @Serializable and @Parcelable both to a class ? i was under impression parcelable can improve app performance over serilization.

  • @Yang-Youtube
    @Yang-Youtube Před měsícem

    The new safe args navigation doesn't seem to work with deeplink.😢

  • @Tbijo54
    @Tbijo54 Před měsícem

    Can we still get runtime args from SavedStateHandle in viewmodels?

  • @sebastianseno9285
    @sebastianseno9285 Před měsícem

    it's also work with Parcelize ?

  • @imammihir
    @imammihir Před měsícem

    Wow 🎉

  • @vengateshm2122
    @vengateshm2122 Před měsícem

    I tried and faced the similar crash.

  • @TomBerghuis
    @TomBerghuis Před měsícem

    Can you access the argument in the viewmodel?

    • @StevdzaSan
      @StevdzaSan  Před měsícem +1

      Yes, you can use SavedStateHandle and call the same toRoute() function within the ViewModel.

  • @skarloti
    @skarloti Před měsícem

    1:38 Is it possible to replace its sealed class Screen with a sealed interface Screen?

    • @StevdzaSan
      @StevdzaSan  Před měsícem

      Haven't used sealed interface that much at all.

  • @pyaesonehan19
    @pyaesonehan19 Před 24 dny

  • @abobus_f1
    @abobus_f1 Před měsícem

    Can you say what the better this navigation or voyager

    • @StevdzaSan
      @StevdzaSan  Před měsícem

      Ah, you're asking hard questions 😄

    • @abobus_f1
      @abobus_f1 Před měsícem

      @@StevdzaSan😄

  • @4ytonly
    @4ytonly Před měsícem +1

    I suggest you change the title of your video to include words navigation so its easier to find later!

  • @ahmetfarukcuha7793
    @ahmetfarukcuha7793 Před měsícem

    eventually :)

  • @Nick-cx4rs
    @Nick-cx4rs Před měsícem +1

    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  Před měsícem

      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 Před měsícem

      ​@@StevdzaSan e.g. disable swipe on bottomsheet. Put scrollable layout in it .bottomSheet closing on swipe. m3

  • @srkrishnan1989
    @srkrishnan1989 Před měsícem

    Try flutter and make difference video

  • @KingFuYouTube
    @KingFuYouTube Před měsícem

    first

  • @sudheeshmohan4357
    @sudheeshmohan4357 Před 5 dny

    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()