-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Open
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listc: 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
Is there an existing issue for this?
- I have searched the existing issues
- I have read the guide to filing a bug
Use case
I would like to use go_router_builder for my app, but the problem i have right now is that i want to use the fragment instead of path or query parameters (ex for say, a file path)
The problem is, i dont see any way to define that without breaking the generator.
class ServerFileEditorRoute extends GoRouteData {
ServerFileEditorRoute({
required this.serverId,
required this.filePath, // should be using the fragment, not query parameter.
});
/* different issue
ServerFileEditorRoute.typed({
required this.serverId,
required FileUri filePath,
}) : filePath = filePath.fullPath;
*/
final ServerId serverId;
final String filePath;
@override
Widget build(BuildContext context, GoRouterState state) {
return ServerFileEditorPage(
key: state.pageKey,
serverId: serverId,
// TODO: pass in the path somehow
// filePath: FileUri(state.uri.fragment), // might work, but then i cant specify it in the constructor
filePath: FileUri(filePath),
);
}
// ensures the fragment is valid, since i want to use it for the parameter
@override
FutureOr<String?> redirect(BuildContext context, GoRouterState state) async {
if (!state.uri.hasFragment) {
return '../';
}
return null;
}
}Proposal
Perhaps a $fragment the same way we have $extra?
ozraru
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listc: 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