@@ -105,15 +105,17 @@ class GoRouterDelegate extends RouterDelegate<RouteMatchList>
105
105
states.first.pop (result);
106
106
}
107
107
108
- /// Get a prioritized list of NavigatorStates
109
- /// 1. Pop routes within branches of shell navigation which `canPop`
110
- /// 2. Pop parent route
111
- /// 3. Pop branch routes (which are exit routes as they cannot be popped)
108
+ /// Get a prioritized list of NavigatorStates,
109
+ /// which either can pop or are exit routes.
110
+ ///
111
+ /// 1. Sub route within branches of shell navigation
112
+ /// 2. Branch route
113
+ /// 3. Parent route
112
114
List <NavigatorState > _findCurrentNavigators () {
113
115
final List <NavigatorState > states = < NavigatorState > [];
114
116
if (navigatorKey.currentState != null ) {
115
- states. add (navigatorKey
116
- . currentState! ); // Set state directly without canPop check
117
+ // Set state directly without canPop check
118
+ states. add (navigatorKey. currentState! );
117
119
}
118
120
119
121
RouteMatchBase walker = currentConfiguration.matches.last;
@@ -127,8 +129,7 @@ class GoRouterDelegate extends RouterDelegate<RouteMatchList>
127
129
// Stop if there is a pageless route on top of the shell route.
128
130
break ;
129
131
}
130
- states.insert (
131
- potentialCandidate.canPop () ? 0 : states.length, potentialCandidate);
132
+ states.insert (0 , potentialCandidate);
132
133
walker = walker.matches.last;
133
134
}
134
135
return states;
0 commit comments