-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
flutter/packages
#2392Labels
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_routerThe go_router packageThe go_router packagepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.
Description
Use case
When writing a url to a page that has to perform a research with some filters these are typically mapped to query params.
Sometimes a filter maps to a list of values. Query params lists are supported by http protocol and by dart Uri for this specific use case.
Ex.: /my-app-home/resource?color=red&size=1&size=2&size=3
Use with Uri object
void main() {
final c = Uri.parse('/my-app-home/resource?color=red&size=1&size=2&size=3');
print(c.queryParametersAll['size']);
}Which will print [1, 2, 3]
Proposal
- Enhancing all navigation functions to support lists of query params
- Support in typed routes
Navigation functions
Current version
String namedLocation(
String name, {
Map<String, String> params = const <String, String>{},
Map<String, String> queryParams = const <String, String>{},
})Proposal example
String namedLocation(
String name, {
Map<String, String> params = const <String, String>{},
Map<String, dynamic> queryParams = const <String, dynamic>{},
})This should work out of the box for named navigation function since routeInformationParser.namedLocation eventually returns Uri(path: location, queryParameters: queryParams).toString()
Typed Route example
class Tab1 extends GoRouteData {
final List<String>? myQuery;
final int? anotherQuery;
Tab1({
this.myQuery,
this.anotherQuery,
});
@override
Page buildPage(BuildContext context) => const NoTransitionPage(
child: RootPage(
key: Root.rootKey,
tabIndex: 0,
),
);
}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_routerThe go_router packageThe go_router packagepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.