popUntil method

void popUntil (BuildContext context, RoutePredicate predicate)

Calls pop repeatedly on the navigator that most tightly encloses the given context until the predicate returns true.

Sample code

Typical usage is as follows:

void _logout() {
  Navigator.popUntil(context, ModalRoute.withName('/login'));
}

Implementation

static void popUntil(BuildContext context, RoutePredicate predicate) {
  Navigator.of(context).popUntil(predicate);
}