offNamedUntil<T> method

Future<T> offNamedUntil<T>(
  1. String page,
  2. RoutePredicate predicate,
  3. {int id,
  4. dynamic arguments}
)

Navigation.pushNamedAndRemoveUntil() shortcut.

Push the given named page, and then pop several pages in the stack until predicate returns true

You can send any type of value to the other route in the arguments.

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 Get.until((route) => !Get.isDialogOpen()), to make sure the dialog is closed

Note: Always put a slash on the route ('/page1'), to avoid unnexpected errors

Implementation

Future<T> offNamedUntil<T>(
  String page,
  RoutePredicate predicate, {
  int id,
  dynamic arguments,
}) {
  return global(id)
      ?.currentState
      ?.pushNamedAndRemoveUntil(page, predicate, arguments: arguments);
}