popUntilRouteWithPath method

void popUntilRouteWithPath(
  1. String path, {
  2. bool scoped = true,
})

Helper to pop all routes until route with path is found see popUntil

Implementation

void popUntilRouteWithPath(String path, {bool scoped = true}) {
  popUntil((route) {
    if ((route.settings is AutoRoutePage)) {
      return (route.settings as AutoRoutePage).routeData.match == path;
    }
    // Assuming pageless routes are either dialogs or bottomSheetModals
    // and the user set a path as in RouteSettings(name: path) when showing theme
    return route.settings.name == path;
  }, scoped: scoped);
}