-
Notifications
You must be signed in to change notification settings - Fork 27.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[go_router_builder] Proposal to improve how we handle extra parameters #117261
Comments
Specifically tackling the
We could define a decorator that's responsible for making sure the generator knows which parameter is the extra one, instead of relying on the name. Ideally, something along this line: class PersonRouteWithExtra extends GoRouteData {
PersonRouteWithExtra({this.$extra});
@Extra() final int? id;
@override
Widget build(BuildContext context) => PersonScreen(personId: id);
} Which would result in a much more clean way of using the route. PersonRouteWithExtra(id: person.id).go(context); |
@dancamdev |
My proposed solution is exactly the same, yes. Still, this issue aims to discuss broader fixes to At the moment I see too many compromises. I tried |
Thanks for the update. I will keep this issue open and treat it as feature request based on above comment. |
Is it possible to use |
In the current version of
go_router_builder
this is the only way to handle extra parameters to the route.This comes with some major developer experience drawbacks in my opinion, among which, the biggest are:
$extra
This leads to having roughly the following line every time you need to use the route (which btw wrongly shows a positional argument in the documentation):
Ideally, I would have a positional parameter or be able to have a custom named one.
The purpose of this issue is to discuss potential improvements on the API
The text was updated successfully, but these errors were encountered: