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.
You can also do it like this
Navigator.of(context)
.pushNamedAndRemoveUntil('/Destination', ModalRoute.withName('/poptillhere'),arguments: if you have any);
The use case is to go the desired screen and pop the screens in between as you require.
For more info, you can check this Post Explaining other Solutions