TabController报错

来源:1-4 如何高效的学习本课程【送你一份高效的课程学习指南】

大官人丶1830085

2022-09-12

I/flutter (13853): loadData():Instance of 'HomeMo’
E/flutter (13853): [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 (13853): Consider canceling any active work during “dispose” or using the “mounted” getter to determine if the State is still active.

运行时TabController会出现这个问题,怎么对mounted进行判断呢?

写回答

1回答

CrazyCodeBoy

2022-09-13

后面章节封装了HiState来做mounted相关的事情,可参考下:
https://git.imooc.com/coding-487/fa-pub/src/master/component/hi_base/lib/hi_state.dart
0
0

Flutter高级进阶实战-仿哔哩哔哩-掌握Flutter高阶技能

一次性掌握Flutter高阶技能+商业级复杂项目架构设计与开发方案

1723 学习 · 870 问题

查看课程