Make it easier to change part of current path
It would be nice if it's easier to alter the current path, such as changing one query parameter.
For instance if the user is on /search?q=blah&order=popular and we want to change to /products?q=blah&order=recent, currently you have to change the entire URL:
Routemaster.of(context).push('/search', queryParameters: {'order': 'recent', 'q': query});
We could make currentRoute writeable and add a copyWith:
final routemaster = Routemaster.of(context);
routemaster.currentRoute = routemaster.currentRoute.copyWith(
queryParameters: {
'order': 'recent',
'q': query
}
);
We could make .push() nullable (but I really don't like this):
Routemaster.of(context).push(null, queryParameters: {'order': 'recent', 'q': query});
...or there could be an entire new method.
But it would be nice if somehow you could just update one parameter, not have to create a new map with all of them.
There could also be Routemaster.of(context).updateRoute((route) => route.copyWith(...))
Or adding a pushRoute method: Routemaster.of(context).pushRoute(RouteData.of(context).copyWith(...))
or Routemaster.of(context).updateRoute(queryParameters: {'order': 'recent', 'q': query}); ?
because I think push is unclear.