Closed dkbast closed 2 years ago
My main concern is that I would like to attach the information about which providers/builders should be added to the GoRoute and not have a separate object holding this information, so I might have to extend GoRoute and find a way to access it again. I was thinking, that the GoRouteMatch'es passed to _builder already has access to all GoRoute objects and that I could build something like getPages() which gets the builders for each GoRoute - I'll try that over the weekend and report back.
Update: I think I will try passing the GoRouteMatch'es to the navigatorBuilder together with adding a navigatorBuilder field to the GoRoute, there could also be a default that if no navigatorBuilder is set that all builders are applied automatically
More or less a dupe of this I think https://github.com/csells/go_router/issues/133
dupe of #133
I often want to provide something to a route and all its sub-routes - for example a QuizDefinition to all the quiz screens which will be added to the stack. So far I have often just added the Provider above the MaterialApp but was never really happy with that, since then I had to remember to reset the Provider etc pp.
I recognise that provider might not be the best name, but I hope it is clear what I want to achieve:
Proposal:
And in go_router_delegate.dart we would have to wrap the section below with a MultiProvider or iterate over the providers which probably could be retrieved while performing the pages lookup.
Open question: how to cache the providers so they are not rebuilt on adding a page to the stack?