popUntil method

void popUntil(
  1. RoutePredicate predicate, {
  2. int? 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: Get.until((route) => Get.currentRoute == '/home')so when you get to home page,

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

Implementation

void popUntil(RoutePredicate predicate, {int? id}) {
  // if (key.currentState.mounted) // add this if appear problems on future with route navigate
  // when widget don't mounted
  return key.currentState?.popUntil(predicate);
}