push<T> method
Push a location onto the page stack.
Implementation
Future<T?> push<T>(
String location, {
Map<String, dynamic> pathParams = const <String, dynamic>{},
Map<String, dynamic> queryParams = const <String, dynamic>{},
Map<String, dynamic> params = const <String, dynamic>{},
}) {
Map<String, dynamic> args = <String, dynamic>{};
if (pathParams.isNotEmpty) args.addAll(pathParams);
if (queryParams.isNotEmpty) args.addAll(queryParams);
if (params.isNotEmpty) args.addAll(params);
routing.args = args;
pathParams.forEach((key, value) {
if (location.contains(":$key")) {
location = location.replaceAll(":$key", value.toString());
}
});
queryParams.forEach((key, value) {
location = "$location${location.contains("?") ? "&" : "?"}$key=$value";
});
return global().push<T>(location, extra: params);
}