# Chapter 7: Dismissing the Grocery Item screen

**URL:** <https://forums.kodeco.com/t/chapter-7-dismissing-the-grocery-item-screen/155367>\
**Category:** Flutter Apprentice\
**Created:** [October 30, 2021, 5:06am UTC](https://forums.kodeco.com/t/chapter-7-dismissing-the-grocery-item-screen/155367 "2021-10-30T05:06:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![matan188](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/matan188/32/81494_2.png) [@matan188](https://forums.kodeco.com/u/matan188)\
**Post date:** [October 30, 2021, 5:06am UTC](https://forums.kodeco.com/t/chapter-7-dismissing-the-grocery-item-screen/155367/1 "2021-10-30T05:06:54Z")

</div>

How does the app\_router know to return to the “To Buy” tabs when the user clicks the back button after executing the following in `_handlePopPage`

```auto
if (route.settings.name == FooderlichPages.groceryItemDetails) {
      groceryManager.groceryItemTapped(-1);
}

```

It seems like there’s no matching pages since `selected_index != -1` and `isCreatingNewItem == false`.

Thanks.

---

<div class="post-metadata">

**Author:** ![jomoka](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jomoka/32/109828_2.png) [@jomoka](https://forums.kodeco.com/u/jomoka)\
**Post date:** [October 30, 2021, 6:12am UTC](https://forums.kodeco.com/t/chapter-7-dismissing-the-grocery-item-screen/155367/2 "2021-10-30T06:12:54Z")

</div>

@matan188 when state changes the navigator’s list of pages gets rebuild based on the new state. You can check out **App\_Router** ’s build() method.
