Eduardo Florence

Add Page Parameter

@@ -206,6 +206,7 @@ class PageRedirect { @@ -206,6 +206,7 @@ class PageRedirect {
206 /// check if redirect is needed 206 /// check if redirect is needed
207 bool needRecheck() { 207 bool needRecheck() {
208 final match = Get.routeTree.matchRoute(settings.name); 208 final match = Get.routeTree.matchRoute(settings.name);
  209 + Get.parameters = match?.parameters;
209 210
210 // No Match found 211 // No Match found
211 if (match?.route == null) { 212 if (match?.route == null) {
@@ -215,7 +216,7 @@ class PageRedirect { @@ -215,7 +216,7 @@ class PageRedirect {
215 216
216 final runner = MiddlewareRunner(match.route.middlewares); 217 final runner = MiddlewareRunner(match.route.middlewares);
217 route = runner.runOnPageCalled(match.route); 218 route = runner.runOnPageCalled(match.route);
218 - Get.parameters = route?.parameter; 219 + addPageParameter(route);
219 220
220 // No middlewares found return match. 221 // No middlewares found return match.
221 if (match.route.middlewares == null || match.route.middlewares.isEmpty) { 222 if (match.route.middlewares == null || match.route.middlewares.isEmpty) {
@@ -228,4 +229,16 @@ class PageRedirect { @@ -228,4 +229,16 @@ class PageRedirect {
228 settings = newSettings; 229 settings = newSettings;
229 return true; 230 return true;
230 } 231 }
  232 +
  233 + void addPageParameter(GetPage route) {
  234 + if (route.parameter == null) return;
  235 +
  236 + if (Get.parameters == null) {
  237 + Get.parameters = route.parameter;
  238 + } else {
  239 + final parameters = Get.parameters;
  240 + parameters.addEntries(route.parameter.entries);
  241 + Get.parameters = parameters;
  242 + }
  243 + }
231 } 244 }