so I'm at a cross roads on the next app I'm doing. I have four routes, each of which add a new argument that will all be tied together at a final screen.
So let's say there's four routes and I called these three functions (starting at route 1)
Navigator.pushNamed(context, 'route2', arguments: <String, String>{'foo': 'bar'});
Navigator.pushNamed(context, 'route3', arguments: <String, String>{'fizz': 'buzz'});
Navigator.pushNamed(context, 'route4', arguments: <String, String>{'mumbo': 'jumbo'});
Would I have access to all of the arguments in the final route? so could I access 'foot','fizz', and 'mumbo'
AFAIK, you have to extract the arguments of the route in the route's widget by using the context of the widget, like
final args = ModalRoute.of(context).settings.arguments;
So, the arguments of the route outside of the one you defined the arguments for, won't have access to those arguments. For example, route3
won't be able to use the argument foo
for that is defined for route1
.
To answer your question, you won't have access to all of these arguments in the final route, since these arguments are not defined for that final route. You probably might want to use state management for that.