Can you suggest a Navigator function

hello guys… i have some routing query… i have 3 routes x, y, and z.
my route is
x -> y -> z
then
z -> x
what Navigator function would you recommend me to use to achieve this?

 Navigator.popUntil(context, ModalRoute.withName('/x'));
1 Like