qlevar_router
qlevar_router copied to clipboard
Add or remove routes in run Time
Hi.
I love add and remove routes !!!!!
I have a problem when I remove a route.
This is my stack tree:
I add the route "products":
QR: Route: Key: 11, Full Path: /dashboard/products was add to Key: 2 QR: Finding Match for /dashboard/products under root QR: adding Route: Key: 11, Full Path: /dashboard/products to the navigator with Key: 9
Now my stack tree is:
If I remove de above route the debug message is:
QR: products is removed from Key: 2
and the stack tree is correct.
If I try to add the same route again the error appears:
The following assertion was thrown while handling a gesture: Assertion failed: file:///C:/Users/Biagio/AppData/Local/Pub/Cache/hosted/pub.dev/qlevar_router-1.10.0/lib/src/routes/qroute_internal.dart:70:14 qroute_internal.dart:70 !QR.treeInfo.namePath.containsKey(route.name) "Route name products (with path /dashboard/products) is already used by path /dashboard/products, please use a unique name for each route."
But the route has been removed ... I don't understand !!!!
Thanks in advance
Biagio
can confirm this issue:
QR.rootNavigator.addRoutes(<QRoute>[
QRoute(path: '/test', builder () => const TestPage())
]);
QR.rootNavigator.removeRoutes(<String>['/test']);
// throws an error Path /test already exist, cannot add
QR.rootNavigator.addRoutes(<QRoute>[
QRoute(path: '/test', builder () => const TestPage())
]);