popUntil method

void popUntil(
  1. BuildContext context,
  2. bool predicate(
    1. RoutebornPage page
    )
)

Pops pages from the current stack until the predicate returns true.

Implementation

void popUntil(
  BuildContext context,
  bool Function(RoutebornPage page) predicate,
) {
  final navState = context.findAncestorStateOfType<NavigatorState>();

  final key = navState?.widget.key ?? rootNavKey;

  _rootPageNodesSetter = _handleStackAction(
    (currentStack) => currentStack.popUntil(predicate),
    key,
  );

  notifyListeners();
}