The preferred solution is to cancel the timer or stop listening to the animation in the dispose() ca

错误内容:
The preferred solution is to cancel the timer or stop listening to the animation in the dispose() callback. Another solution is to check the “mounted” property of this object before calling setState() to ensure the object is still in the tree.

首选的解决方案是取消计时器或停止听dispose()回调的动画。另一个解决方案是之前检查这个对象的“安装”属性调用设置状态(),以确保对象仍然在树上。

解决方案:
在调用setState方法前加入

if(!mounted){
        return;
      }

你可能感兴趣的:(Flutter,flutter)