Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter 颤振-在dispose()之后调用的设置状态_Flutter_Dart - Fatal编程技术网

Flutter 颤振-在dispose()之后调用的设置状态

Flutter 颤振-在dispose()之后调用的设置状态,flutter,dart,Flutter,Dart,我的应用程序中有一个TextFieldController,但每次我用键盘键入任何内容时,整个应用程序都会重新加载并显示错误 Error: setState() called after dispose(): _SlidingPanelState#65b14(lifecycle state: defunct, not mounted) 该错误似乎与TextFieldController有关,但我不确定它为什么会干扰TextFieldController SliverToBoxAdapter

我的应用程序中有一个TextFieldController,但每次我用键盘键入任何内容时,整个应用程序都会重新加载并显示错误

Error: setState() called after dispose(): _SlidingPanelState#65b14(lifecycle state: defunct, not mounted)
该错误似乎与TextFieldController有关,但我不确定它为什么会干扰TextFieldController

  SliverToBoxAdapter(
                  child: Container(
                    height: 100,
                    padding: const EdgeInsets.all(20.0),
                    child: TextField(
                      decoration: InputDecoration(
                          border: InputBorder.none,
                          labelText: 'Enter Name',
                          hintText: 'Enter Your Name'),
                    ),
                  ),
                ),

在您的_SlidengPanelState中查找

setState(() {);
并改变它

if (mounted) {
   setState(() {);
}