-
Notifications
You must be signed in to change notification settings - Fork 29.2k
Open
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterp: go_router_builderThe go_router_builder packageThe go_router_builder packagepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.team-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team
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
mzdm, fpgalan, NeroThroN, OliverRhyme and NearTox
Metadata
Metadata
Assignees
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterp: go_router_builderThe go_router_builder packageThe go_router_builder packagepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.team-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team