Flutter Go Router

Sdílet
Vložit
  • čas přidán 27. 08. 2024

Komentáře • 12

  • @PankajNikam
    @PankajNikam Před 4 měsíci +1

    I Prefer using constants on the page itself to use for navigation. I personally use the PageName.Route and use it everywhere. Each page knows what the name of itself is. Thanks for the video :) It has been helpful. I loved the part where you keep the go_router inside its own file and keep things clean in the main screen.

    • @1ManStartup
      @1ManStartup  Před 4 měsíci

      Are the constants then replacing the enum? so you'd have for example
      const game = "game"
      then use game for the name & "/$game" for the path?
      Seems like a good way to do it

    • @PankajNikam
      @PankajNikam Před 4 měsíci

      @@1ManStartup No, they are not enum. They are strings and I call it like Navigator.of(context).pushNamed(PageToNavigate.Route);

    • @1ManStartup
      @1ManStartup  Před 4 měsíci +1

      @@PankajNikam oh got it so then you're not using go router at all?

    • @PankajNikam
      @PankajNikam Před 4 měsíci

      @@1ManStartup Whether you use it or not, I prefer this way because the page itself should know what its own name is. If I have to change the name, I know where to go instead of hunting a gigantic constants file (this can be solved though through simple refactoring)... It is just my way of coding. There may be other good ways though.

    • @huzeyfetas
      @huzeyfetas Před 3 měsíci

      the store path and the name in the screen file can conflict. for example you have 30 screens in your application. for example you have a forgot password screen and a password change screen.
      on the forgot password screen you can use name = "resetPassword" while on the password change screen someone else can use name = "resetPassoword". enum doesn't make you visit a page, but you can use advanced enum usage with parameters. not just a name. use enums in constructive ways... ( funny part in this message, I am also keep the path and name value in the page :) but I'm not happy with it. as I said you can accidentally use the same path or name value on another page. it can be overlooked... I recommend advanced enum usage )

  • @leleemagnu6831
    @leleemagnu6831 Před 4 měsíci

    Great video! Concise, and to the point!. Thank you!

  • @mohammedarbazshaikh4883
    @mohammedarbazshaikh4883 Před 4 měsíci

    What extensions do you use for suggestions (which show the expected)?

    • @1ManStartup
      @1ManStartup  Před 4 měsíci

      Not sure exactly what you mean but this video shows my whole VSCode setup czcams.com/video/rSI3-zxJZVc/video.html