Flutter remove all routes

前端 未结 10 1894
难免孤独
难免孤独 2021-01-30 04:46

I want to develop a logout button that will send me to the log in route and remove all other routes from the Navigator. The documentation doesn\'t seem to explain h

10条回答
  •  时光取名叫无心
    2021-01-30 05:28

    Another alternative is popUntil()

    Navigator.of(context).popUntil(ModalRoute.withName('/root'));
    

    This will pop all routes off until you are back at the named route.

自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题