Flutter - How do I pop two screens without using named routing?
Use popUntil
method of Navigator class.
e.g.
int count = 0;
Navigator.of(context).popUntil((_) => count++ >= 2);
However, I would recommend defining names for your routes and using popUntil
as it is designed as per docs.
Let me know if this helped.
You can just pop it two times;
nav = Navigator.of(context);
nav.pop();
nav.pop();