I am recursively adding routes to the navigator. There could be 20 views or more. Pop works as advertised, but I would like to pop to index 1 and remove all push history.
Use popUntil method as mentioned in the docs
Typical usage is as follows: Navigator.popUntil(context, ModalRoute.withName('/login'));
Typical usage is as follows:
Navigator.popUntil(context, ModalRoute.withName('/login'));