Chapter 7: Dismissing the Grocery Item screen

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

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.

@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.