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???
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.
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?
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.
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
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?
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)
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
There is no direct parameter “navigationKey” for MaterialApp.router. But most of the things from navigationKey can be accessed from AutoRouter.of(context).
Thanks, for the "part" to "import", it is not mentioned anywhere on the documentation, got the solution from you. Thanks
so amazing, hero
Can we remove transition/animation of auto route?? coz its showing unnecessary
flicker in android
Sahi ho, mero ma generated file issue aayera tanab vako thiyo, thanks for your insights. maybe next video ma AutoRouteGuard bare kei info paamna.
ua-cam.com/video/c84S_tB-Vz8/v-deo.html
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???
Here is a playlist where you can find more videos related to Auto Route implementation:
ua-cam.com/video/Th83H6qv4Z8/v-deo.html
in 6:30, Flutter said: make sure you don't initiate your router inside of the build function
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.
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?
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.
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
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?
Do you have
part 'app_router.gr.dart';
Inside your app_router.dart file ?
the same problem
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)
Did you try deleting the generated file and running build_runner build command again?
You used stless screen. Can't I use stful screen?
Yeah you can use
@@nepali-programmer will it work fine.
Yes
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
Good integration but I see no reason to stop using go_router
And I see no reason to stop using auto_router!
hello, how can i setup navigationKey with MaterialApp.router?
There is no direct parameter “navigationKey” for MaterialApp.router. But most of the things from navigationKey can be accessed from AutoRouter.of(context).
@@nepali-programmer Thank You