3

I have multiple screens and I'm using named routes in flutter using getx package. The problem I'm facing is I'm able to navigate to any other screen when tapped on push notification, but when I go back from that screen my app closes. But expected outcome is when navigating back I should go to home screen and app should not close. Please help

Mickey
  • 31
  • 2

1 Answers1

0

Try using the following when back button is pressed:

Navigator.popAndPushNamed(context, '/homeScreen')
Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
Samia Ashraf
  • 195
  • 5
  • Ok thanks, So i was handling all named routes in single class, how can manage above code in single place? Where should I use this code so that it works for all screens ? – Mickey Mar 11 '22 at 02:38