stacked
stacked copied to clipboard
[docs]: Looks like you're trying to navigate to a nested route without adding their parent to stack first
Describe the missing piece of documentation
I couldn't find any documentation that discusses using sub-routes for web.
Hi @KhalilAmor , I will try to add nested routes documentation as soon as possible.
I had the same problem, it took me a while to understand how to solve this error. This happens if you are trying to route from one nested page to another in another branch of the navigation tree. For example considering the following the page structure:
CustomRoute(
page: MainView, path: '/',
children: [
CustomRoute(page: HomeView, initial: true, path: 'home'),
CustomRoute(page: WhoweareView, path: 'chisiamo'),
CustomRoute(page: ExecutiveView, path: 'direttivo'),
CustomRoute(page: StaffView, path: 'staff'),
CustomRoute(page: DocumentsNavigation, path: 'documenti', children: [
CustomRoute(page: DocumentsView, initial: true),
]),
CustomRoute(page: EventsView, path: 'eventi'),
CustomRoute(page: VolunteersView, path: 'volontariato'),
CustomRoute(page: ContactsView, path: 'contatti', maintainState: false),
CustomRoute(page: TeachersNavigation ,path: 'insegnanti', children: [
CustomRoute(page: TeachersView,initial: true),
CustomRoute(page: TeachersDetailsView),
]),
CustomRoute(page: CoursesNavigation,path: 'corsi', children: [
CustomRoute(page: CoursesView, initial: true),
CustomRoute(page: CoursesDetailsView),
]),
CustomRoute(page: PrivacyinfoView, path: 'privacy', maintainState: false),
CustomRoute(page: CvVittorioParagalloView, path: 'cv-vittorio-paragallo', maintainState: false),
],
To navigate from DocumentsView to PrivacyinfoViewRoute:
final _routerService = locator<RouterService>();
_routerService.navigateTo(MainViewRoute(children: [PrivacyinfoViewRoute()]));
Nested routes has been added.