Force Flutter navigator to reload state when popping

前端 未结 14 2197
情书的邮戳
情书的邮戳 2020-11-28 22:54

I have one StatefulWidget in Flutter with button, which navigates me to another StatefulWidget using Navigator.push(). On second widge

14条回答
  •  野性不改
    2020-11-28 23:01

    This simple code worked for me to go to the root and reload the state:

        ...
        onPressed: () {
             Navigator.of(context).pushNamedAndRemoveUntil('/', ModalRoute.withName('/'));
                    },
        ...
    

提交回复
热议问题