4

I use Getx for route management in my Flutter application.

When a certain notification arrives and the app starts from terminated state I want:

  • launch the / route (launch screen)
  • go to potm/:match_id route
  • when user presses back go to match/:match_id route
  • when user presses back go to home route

Basically I want to have this stack: home -> match/:match_id -> potm:/match_id and then popping from the top will bring me back at home

In the / page initState method I do the following

var matchId = getMatchId();
Get.offToNamed("/home");                         // place home on stack and remove /
Get.toNamed("/match/" + matchId);                // place /match/:match_id on stack 
await Get.toNamed("/potm/" + matchId);           // go to /potm/:match_id

this kind of works but in some devices I see a very fast transition from / to /home which I don't want to see

What is the best way to achieve my desired stack here?

alexlipa
  • 1,131
  • 2
  • 12
  • 27

1 Answers1

0

I couldn’t find a way using imperative navigation. I opted for declarative navigation using GoRouter

alexlipa
  • 1,131
  • 2
  • 12
  • 27