until method

void until(
  1. bool predicate(
    1. JetPage
    ), {
  2. String? id,
})

Navigation.popUntil() shortcut.

Calls pop several times in the stack until predicate returns true

id is for when you are using nested navigation, as explained in documentation

predicate can be used like this: Jet.until((route) => Jet.currentRoute == '/home')so when you get to home page,

or also like this: Jet.until((route) => !Jet.isDialogOpen()), to make sure the dialog is closed

Implementation

void until(bool Function(JetPage<dynamic>) predicate, {String? id}) {
  // if (key.currentState.mounted) // add this if appear problems on future with route navigate
  // when widget don't mounted
  return searchDelegate(id).backUntil(predicate);
}