Closed AdnaneX closed 1 year ago
That would be very useful. Do you have an idea how or where to get this map later?
SchabanBo, I have done a few refactors on a project I've been working on for ~9 months based on this router. Coming from Angular, I love what you have done here. The title above is a key element of the meta related to a route. There is some depth here, too, which is that the title will likely be localized and not just a plain string but the result of the intl package. In this case, it needs a BuildContext, and quickly becomes a circular and/or late loading variable problem.
I have been able to solve for much of this but it becomes way more complex than just getting a string property into that metadata. It could also include an array of form fields for the form that renders off that route; each with their own set of internationalized prompts and error messages. The route itself could be built as a factor of abstracting the CRUD methods from objects in use within the application. In that case, I've attached the widget that renders each method as a member of AdnaneX' proposed map.
The map can be collected from a service at runtime based on the name of the active route, etc. and in my case I have used GetX observables. Some detail can be provided by a Controller on the route, too. All of these methods are implemented without needing to extend the router.
I'll give a hint by saying one of the eye-opening intermediate steps was to enumerate the list of unique route names I had within the application, and start running extensions off the enums.
So that now available in V1.8.1 Get it with
QR.currentRoute.meta
// or
QR.navigator.currentRoute.meta
Example: