-
Hello, I made an example, for these issue #279 and #282. my example https://github.com/iAmTosuj/go_router_exemple, I left comments in the code. I described everything in the readme and will duplicate it here. Feature request.The application has authentication by code and deep link. I open the application using the link and I need to get to it after I enter the authentication code. To do this, I need to remember the link before authentication. It would be convenient if I received not only a string, but also the name of this link, so it would be easier to check it. You can see an example in the router_redirect file. in the state Router, it would be possible to transmit the entire route history in a flat list. In my case, I would take the last matched route and check its name and the name of my deeplinks. Then you don't need to write regular expressions for location params Strange behavior.The page is recreated every time you return to it or use hot restart. But the strangest thing is that all final fields are created anew, and the old fields remain in widget. You can see an example with bloc in the main_page file. Before that, I used the auto_router library and there was no such problem, the constructor was never called when going back through history or when use hot restart. i can do this, but how can I change the parameters of this page if they are passed to the constructor? final mainPage = MainPage();
GoRoute(path: '/main', builder: (context, state) => mainPage,) You can make it so that if the page has already been created, it will be cached and when you return to it, a new instance will not be created, it will be taken from the cache? Maybe I'm doing something wrong and I'm having these problems. Please help if possible. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
You can ask Flutter to cache the state of any widget you like -- that's what a |
Beta Was this translation helpful? Give feedback.
-
what about adding route history to the root redirect for GoRouter, is it possible? or is there such a need only for me? |
Beta Was this translation helpful? Give feedback.
-
What kind of route history do you mean? Are you looking for a list of everywhere the user has been in the app? You can get that today by passing in a |
Beta Was this translation helpful? Give feedback.
-
You can get a list of matching routes today from |
Beta Was this translation helpful? Give feedback.
You can ask Flutter to cache the state of any widget you like -- that's what a
StatefulWidget
is. Put the state that you want kept between invocations into your State object and overridedidUpdateWidget
for new data in the associatedwidget
. You can read more here: https://flutterbyexample.com/lesson/stateful-widget-lifecycle