popAllRoutes static method

void popAllRoutes(
  1. int index
)

pops all routes except first, if there are more than 1 route in each navigator stack

Implementation

static void popAllRoutes(int index) {
  NavigatorState? currentState;
  for (int i = 0; i < _keys.length; i++) {
    if (_index == i) {
      currentState = _keys[i].currentState;
    }
  }
  if (currentState != null && currentState.canPop()) {
    currentState.popUntil((route) => route.isFirst);
  }
}