The following assertion was thrown while finalizing the widget tree: _FindIdState.dispose failed to call super.dispose.

김찬혁·2021년 10월 1일
0

오류내용

======== Exception caught by widgets library =======================================================
The following assertion was thrown while finalizing the widget tree:
_FindIdState.dispose failed to call super.dispose.

dispose() implementations must always call their superclass dispose() method, to ensure that all the resources used by the widget are fully released.
When the exception was thrown, this was the stack: 
#0      StatefulElement.unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:4804:7)
#1      StatefulElement.unmount (package:flutter/src/widgets/framework.dart:4811:6)
#2      _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1847:13)
#3      _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#4      SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:6070:14)
...
====================================================================================================

나의 실수:

@override
void dispose(){
	controller.dispose();
}

해결 방법:

@override
void dispose(){
	super.dispose();
	controller.dispose();
}

해당 컨트롤러를 dispose를 시키기 위해서 가장 위의 트리인 녀석을 먼저 호출을 했어야 했다!

0개의 댓글