07 Back button and Navigation issue

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

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

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

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

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

Thank you.

@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

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.

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