popUntil method

bool popUntil(
  1. LocationPredicate predicate
)

Implementation

bool popUntil(LocationPredicate predicate) {
  final navigatorKey = _navigatorKeys[_currentIndex];
  if (navigatorKey.currentState == null) {
    return false;
  }

  final routerDelegate = _routerDelegates[_currentIndex];
  final destination = routerDelegate.currentConfiguration.locations
      .firstWhereOrNull((location) => predicate(location));
  if (destination == null) {
    return false;
  }

  navigatorKey.currentState?.popUntil((route) {
    return route.settings.name == destination.path;
  });

  return true;
}