code: public void goBackTo(final Screen screen, NavigationType navigationType) {
      navigate(new HistoryRewriter() {
        @Override
        public void rewriteHistory(Deque<Screen> history) {
          checkArgument(history.contains(screen), "Can't go back to a screen that isn't in history.");
          while (history.size() > 1) {
            if (history.peek() == screen) {
              break;
            }
            history.pop();
          }
        }
      }, navigationType, BACKWARD);
    }
docs: Navigates from the current screen back to the Screen parameter wherever it is in this Navigator's back stack.
  Screens in between the current screen and the Screen parameter on the back stack are removed. If the Screen
  parameter is not present in this Navigator's back stack, this method is equivalent to
  {@link #goBackToRoot(NavigationType) goBackToRoot(navigationType)}
  
  @param screen  screen to navigate back to through this Navigator's back stack
  @param navigationType  determines how the navigation event is animated