# 07 Back button and Navigation issue

**URL:** <https://forums.kodeco.com/t/07-back-button-and-navigation-issue/159365>\
**Category:** Flutter Apprentice\
**Created:** [December 4, 2021, 4:43pm UTC](https://forums.kodeco.com/t/07-back-button-and-navigation-issue/159365 "2021-12-04T16:43:43Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![antonio55](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/antonio55/32/81494_2.png) [@antonio55](https://forums.kodeco.com/u/antonio55)\
**Post date:** [December 4, 2021, 4:43pm UTC](https://forums.kodeco.com/t/07-back-button-and-navigation-issue/159365/1 "2021-12-04T16:43:43Z")

</div>

In chapter 7 routes and navigation, when I hit back button I don’t get the login screen, but app exits.

I don’t know why all the navigation machinery doesn’t work.

I suspect I have wrong environment setting.

Thanks for the help

---

<div class="post-metadata">

**Author:** ![funkyboy](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/funkyboy/32/109099_2.png) [@funkyboy](https://forums.kodeco.com/u/funkyboy)\
**Post date:** [December 4, 2021, 6:50pm UTC](https://forums.kodeco.com/t/07-back-button-and-navigation-issue/159365/2 "2021-12-04T18:50:31Z")

</div>

At the end of the chapter there’s details about this. Did you get there?

---

<div class="post-metadata">

**Author:** ![antonio55](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/antonio55/32/81494_2.png) [@antonio55](https://forums.kodeco.com/u/antonio55)\
**Post date:** [December 4, 2021, 11:30pm UTC](https://forums.kodeco.com/t/07-back-button-and-navigation-issue/159365/3 "2021-12-04T23:30:30Z")

</div>

If you mean this line of code:  
backButtonDispatcher: RootBackButtonDispatcher(),  
I am using the code from the book, and it has this line of code.

---

<div class="post-metadata">

**Author:** ![funkyboy](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/funkyboy/32/109099_2.png) [@funkyboy](https://forums.kodeco.com/u/funkyboy)\
**Post date:** [December 5, 2021, 8:59am UTC](https://forums.kodeco.com/t/07-back-button-and-navigation-issue/159365/4 "2021-12-05T08:59:42Z")

</div>

Right. That’s the one. If you run the final project does it behave the same?

---

<div class="post-metadata">

**Author:** ![antonio55](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/antonio55/32/81494_2.png) [@antonio55](https://forums.kodeco.com/u/antonio55)\
**Post date:** [December 5, 2021, 6:28pm UTC](https://forums.kodeco.com/t/07-back-button-and-navigation-issue/159365/5 "2021-12-05T18:28:36Z")

</div>

Yes.  
But if I insert a dummy page in Navigator. pages all goes right.  
It seems that if the stack of the navigator has only a single page, when I hit back button  
I have no chace to handle the command.  
I have also notes if the Navigator has two pages, before I can handle the back button, I see  
the animation discover the second page, and after the system calls the Navigator.onPopPage  
function.

Thank you.  
Bye

---

<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:** [December 7, 2021, 2:18pm UTC](https://forums.kodeco.com/t/07-back-button-and-navigation-issue/159365/6 "2021-12-07T14:18:36Z")

</div>

@antonio55 what are you trying to do?

If you try to hit the android system back button with only 1 page left it will go to the android home screen.

One solution would be to listen if the app goes to the background, or if the app is closed.

You can check the app life cycle to see if it’s resumed, inactive, paused, or detached

---

<div class="post-metadata">

**Author:** ![antonio55](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/antonio55/32/81494_2.png) [@antonio55](https://forums.kodeco.com/u/antonio55)\
**Post date:** [December 7, 2021, 5:57pm UTC](https://forums.kodeco.com/t/07-back-button-and-navigation-issue/159365/7 "2021-12-07T17:57:14Z")

</div>

I am trying to run the example in chapter 7, and understanding Navigator 2.0 .  
It doesn’t seem to work as explained in the book.

Thank you.  
Bye

---

<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:** [December 8, 2021, 5:34am UTC](https://forums.kodeco.com/t/07-back-button-and-navigation-issue/159365/8 "2021-12-08T05:34:51Z")

</div>

May i know which example you are trying to run? It would be helpful if you could share how you configure your pages.
