flutter Pop卡在一个屏幕上并抛出错误

p4tfgftt  于 2023-05-19  发布在  Flutter
关注(0)|答案(1)|浏览(206)

在我的应用程序中,我有一个屏幕序列,在使用后应该返回到第一个屏幕,我使用一个计数器来记录我应该弹出多少次,但由于某种原因,它并没有一直弹出,并停留在序列的第一个屏幕上,并抛出此错误:

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: This widget has been unmounted, so the State no longer has a context (and should be considered defunct).
E/flutter (19475): Consider canceling any active work during "dispose" or using the "mounted" getter to determine if the State is still active.

这是我用来弹出

void closeAction() {
    Navigator.of(context).pop(widget.backTimes);
  }

我已经尝试手动设置该值,但错误仍然存在,所以我认为该方法是确定的。

ohtdti5x

ohtdti5x1#

有一个对话框,由于某种原因导致的错误,只是删除它。

相关问题