Auto Route | Simplify Flutter Navigation | Setup & Basic | Flutter Tutorial

Поділитися
Вставка
  • Опубліковано 2 лис 2024

КОМЕНТАРІ • 27

  • @rishabhbajpai6234
    @rishabhbajpai6234 7 місяців тому +1

    Thanks, for the "part" to "import", it is not mentioned anywhere on the documentation, got the solution from you. Thanks

  • @Geek-jx3gw
    @Geek-jx3gw 2 місяці тому

    so amazing, hero

  • @varshumandloi3365
    @varshumandloi3365 Місяць тому

    Can we remove transition/animation of auto route?? coz its showing unnecessary
    flicker in android

  • @ribeshbasnet-c8f
    @ribeshbasnet-c8f Рік тому

    Sahi ho, mero ma generated file issue aayera tanab vako thiyo, thanks for your insights. maybe next video ma AutoRouteGuard bare kei info paamna.

  • @keldaalonso6226
    @keldaalonso6226 Рік тому

    Thank you for this. i was stucked somewhere and this video has helped me find where i made an error. Thanks again
    please can you send me link to the complex implementation of the auto routing???

    • @nepali-programmer
      @nepali-programmer  Рік тому

      Here is a playlist where you can find more videos related to Auto Route implementation:
      ua-cam.com/video/Th83H6qv4Z8/v-deo.html

  • @skypointvn
    @skypointvn Рік тому +2

    in 6:30, Flutter said: make sure you don't initiate your router inside of the build function

    • @nepali-programmer
      @nepali-programmer  Рік тому

      Yeah it is not a great idea to initiate a router inside the build function. It may impact the performance of the app due to rebuilds. To mitigate these concerns, you might consider using a StatefulWidget instead of a StatelessWidget for your top-level widget. By doing so, you can create the AppRouter instance in the initState method, ensuring it is only created once when the widget is first initialized.
      Here in the above example i created AppRouter inside build as I am 100% sure the parent widget will not trigger rebuild of this Stateless widget as it is the top level widget in the widget tree.
      It should be avoided when you need rebuilds above the material app. (Theme change, Locale change, MediaQuery change).
      In general initiating AppRouter inside build function should be avoided.

  • @rabindraacharya5899
    @rabindraacharya5899 Рік тому

    Prior to initiating the AppRouter class, you made references to "part" and "_$" in the code. However, upon encountering an issue, you decided to replace "part" with "import" and eliminate the use of "_". Is this approach taken initially to handle routing config?

    • @nepali-programmer
      @nepali-programmer  Рік тому

      The usage of the auto_route_generator library appears to vary based on different versions. In certain versions, using the 'part' keyword seems to be effective, while in others, employing 'import' after removing underscores from the code might be necessary. It's worth noting that relying solely on the documentation provided on pub.dev may not always yield consistent results, as updates and changes might not be fully reflected. Therefore, I've presented a potential solution based on this observation.

  • @mr.kashyapsandesh1084
    @mr.kashyapsandesh1084 8 місяців тому

    it's not suitable for state persistance what if the data is user is in shared prefrences it initial route always hit to that config inital:true routepage

  • @razvan3921
    @razvan3921 Рік тому

    When doing dart run build_runner build --delete-conflicting-outputs (at 2:00) the file app_router.gr.dart does not generate for me. What am I doing wrong?

    • @nepali-programmer
      @nepali-programmer  Рік тому

      Do you have
      part 'app_router.gr.dart';
      Inside your app_router.dart file ?

    • @urinbayeeva24
      @urinbayeeva24 8 місяців тому

      the same problem

  • @nasridinov17
    @nasridinov17 Рік тому

    In 4:20 you have issue, i tried like you showed in a video but it didn't help. It remains how it is. Dart run build_runner build --delete-conflicting-outputs, showing succeeded with 0 outputs (0 actions)

    • @nepali-programmer
      @nepali-programmer  Рік тому

      Did you try deleting the generated file and running build_runner build command again?

  • @HrithikRajput-o6b
    @HrithikRajput-o6b 8 місяців тому

    You used stless screen. Can't I use stful screen?

  • @leonardomaiadev
    @leonardomaiadev 6 місяців тому

    there is no sense to use this instead the routes and ongenerate route already given by the flutter. A lot of more complicated, generate code and do the same thing

  • @victorflores7489
    @victorflores7489 Рік тому

    Good integration but I see no reason to stop using go_router

  • @thuanphamvan6210
    @thuanphamvan6210 Рік тому

    hello, how can i setup navigationKey with MaterialApp.router?

    • @nepali-programmer
      @nepali-programmer  Рік тому +1

      There is no direct parameter “navigationKey” for MaterialApp.router. But most of the things from navigationKey can be accessed from AutoRouter.of(context).

    • @thuanphamvan6210
      @thuanphamvan6210 Рік тому

      @@nepali-programmer Thank You