In the compay I'm working on, I'm trying to upgrade from old versions of stacked (2.2.8) / stacked_generator (0.5.7).
I don't have problem navigating to parent routes, but once I try to navigate to a nested one I get an exception: Could not find a generator for route RouteSettings("giftguide", {"groupId": "myGroup", "key": "null"}) in the _WidgetsAppState.
I made a quick sample to reproduce the problem, the navigation stack is Home -> ShopScreen -> GiftGuide
The error I get is
[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: Could not find a generator for route RouteSettings("giftguide", {"groupId": "myGroup", "key": "null"}) in the _WidgetsAppState.
Make sure your root app widget has provided a way to generate
this route.
Generators for routes are searched for in the following order:
1. For the "/" route, the "home" property, if non-null, is used.
2. Otherwise, the "routes" table is used, if it has an entry for the route.
3. Otherwise, onGenerateRoute is called. It should return a non-null value for any valid route not handled by "home" and "routes".
4. Finally if all else fails onUnknownRoute is called.
Unfortunately, onUnknownRoute was not set.
#0 _WidgetsAppState._onUnknownRoute.<anonymous closure> (package:flutter/src/widgets/app.dart:1438:9)
#1 _WidgetsAppState._onUnknownRoute (package:flutter/src/widgets/app.dart:1453:6)
#2 NavigatorState._routeNamed (package:flutter/src/widgets/navigator.dart:4231:37)
#3 NavigatorState.pushNamed (<…>
There's an additional method to navigateToNestedRoute you should use that instead of the navigateToRoute function as that expects a top level route, or a route available in the current navigator.
Describe the bug
In the compay I'm working on, I'm trying to upgrade from old versions of stacked (2.2.8) / stacked_generator (0.5.7). I don't have problem navigating to parent routes, but once I try to navigate to a nested one I get an exception:
Could not find a generator for route RouteSettings("giftguide", {"groupId": "myGroup", "key": "null"}) in the _WidgetsAppState.
I made a quick sample to reproduce the problem, the navigation stack is Home -> ShopScreen -> GiftGuideThe error I get is
Is there is something I'm missing? Thank you
To reproduce
build.yaml
main.dart
shop_screen.dart:
router.dart:
router.router.dart:
Expected behavior
I expect to navigate to the GiftGuide screen
Screenshots
No response
Additional Context
No response