From 809bba09d4365ced48394dd5edf7b46898e44cb7 Mon Sep 17 00:00:00 2001 From: hohieuu Date: Tue, 18 Jul 2023 09:58:41 +0700 Subject: [PATCH] fix router neglect - add the missing logic --- packages/go_router/lib/src/builder.dart | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/go_router/lib/src/builder.dart b/packages/go_router/lib/src/builder.dart index 72d0574eb913..f03444ffa2b3 100644 --- a/packages/go_router/lib/src/builder.dart +++ b/packages/go_router/lib/src/builder.dart @@ -114,12 +114,22 @@ class RouteBuilder { GlobalKey navigatorKey, Map, GoRouterState> registry, ) { + List>? pages; + if (routerNeglect) { + Router.neglect(context, () { + pages = buildPages(context, matchList, onPopPage, routerNeglect, + navigatorKey, registry); + }); + } else { + pages = buildPages( + context, matchList, onPopPage, routerNeglect, navigatorKey, registry); + } + assert(pages != null); return builderWithNav( context, _buildNavigator( onPopPage, - buildPages(context, matchList, onPopPage, routerNeglect, navigatorKey, - registry), + pages!, navigatorKey, observers: observers, ),