pop<T extends Object?> method
void
pop<T extends Object?>([
- T? result
Pops the top-most route.
Implementation
void pop<T extends Object?>([T? result]) {
NavigatorState? state;
if (navigatorKey.currentState?.canPop() ?? false) {
state = navigatorKey.currentState;
}
RouteMatchBase walker = currentConfiguration.matches.last;
while (walker is ShellRouteMatch) {
if (walker.navigatorKey.currentState?.canPop() ?? false) {
state = walker.navigatorKey.currentState;
}
walker = walker.matches.last;
}
if (state == null) {
throw GoError('There is nothing to pop');
}
state.pop(result);
}