Open
Description
In the current version of go_router_builder
this is the only way to handle extra parameters to the route.
class PersonRouteWithExtra extends GoRouteData {
PersonRouteWithExtra({this.$extra});
final int? $extra;
@override
Widget build(BuildContext context) => PersonScreen(personId: $extra);
}
This comes with some major developer experience drawbacks in my opinion, among which, the biggest are:
- forced named parameter
- parameter type must be optional because it must be named and cannot be required
- parameter must be named
$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):
PersonRouteWithExtra($extra: Person(name: 'Marvin', age: 42)).go(context);
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