Flutter- came back to previous page

388

I think you should simply use Navigator.push instead of Navigator.pushAndRemoveUntil.

Share:
388
M.A.
Author by

M.A.

Updated on January 03, 2023

Comments

  • M.A.
    M.A. 10 months

    In my details page there's a button for displaying side menu. I've to go other page by using side menu and came back to Details page. For this I'm using below code.

    Navigator.pushAndRemoveUntil(
        context,
        MaterialPageRoute(
            builder: (context) => Details(id1: widget.items.id1, id2: widget.items.id2,) ),
            (route) => false
    );
    

    But the problem of using this piece of code is when I'm use go other page and came to Details page multiple times it'll blackout the screen.

    Now, how could I route this to came back to my Details page with MaterialPageRoute()?