Flutter Navigation pop to index 1

前端 未结 9 1303
梦毁少年i
梦毁少年i 2020-12-02 13:54

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.

9条回答
  •  有刺的猬
    2020-12-02 14:37

    Use popUntil method as mentioned in the docs

    Typical usage is as follows:

    Navigator.popUntil(context, ModalRoute.withName('/login'));

提交回复
热议问题