인프런 커뮤니티 질문&답변

김지현님의 프로필 이미지
김지현

작성한 질문수

[코드팩토리] [중급] Flutter 진짜 실전! 상태관리, 캐시관리, Code Generation, GoRouter, 인증로직 등 중수가 되기 위한 필수 스킬들!

Get Me API 작업하기

질문있습니다ㅠ

작성

·

297

0

아래 화면을 구현했습니다.

그런데 재시작을 할 때마다, 아래와 같은 오류가 뜹니다.

======== Exception caught by widgets library =======================================================

The following assertion was thrown while finalizing the widget tree:

_PaginationListViewState<IModelWithId>.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:5513:7)

#1 StatefulElement.unmount (package:flutter/src/widgets/framework.dart:5520:6)

#2 ConsumerStatefulElement.unmount (package:flutter_riverpod/src/consumer.dart:578:11)

#3 InactiveElements.unmount (package:flutter/src/widgets/framework.dart:1952:13)

#4 InactiveElements.unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1950:7)

#5 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:5349:14)

#6 InactiveElements.unmount (package:flutter/src/widgets/framework.dart:1948:13)

#7 InactiveElements.unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1950:7)

#8 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:5349:14)

#9 InactiveElements.unmount (package:flutter/src/widgets/framework.dart:1948:13)

#10 InactiveElements.unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1950:7)

#11 SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:6420:14)

#12 InactiveElements.unmount (package:flutter/src/widgets/framework.dart:1948:13)

#13 InactiveElements.unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1950:7)

#14 SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:6420:14)

#15 InactiveElements.unmount (package:flutter/src/widgets/framework.dart:1948:13)

#16 InactiveElements.unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1950:7)

#17 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:5349:14)

#18 InactiveElements.unmount (package:flutter/src/widgets/framework.dart:1948:13)

#19 InactiveElements.unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1950:7)

#20 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:5349:14)

#21 InactiveElements.unmount (package:flutter/src/widgets/framework.dart:1948:13)

#22 InactiveElements.unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1950:7)

#23 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:5349:14)

#24 InactiveElements.unmount (package:flutter/src/widgets/framework.dart:1948:13)

#25 InactiveElements.unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1950:7)

#26 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:5349:14)

#27 InactiveElements.unmount (package:flutter/src/widgets/framework.dart:1948:13)

#28 InactiveElements.unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1950:7)

#29 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:5349:14)

#30 InactiveElements.unmount (package:flutter/src/widgets/framework.dart:1948:13)

#31 ListIterable.forEach (dart:_internal/iterable.dart:39:13)

#32 InactiveElements.unmountAll (package:flutter/src/widgets/framework.dart:1961:25)

#33 BuildOwner.lockState (package:flutter/src/widgets/framework.dart:2639:15)

#34 BuildOwner.finalizeTree (package:flutter/src/widgets/framework.dart:3049:7)

#35 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:919:19)

#36 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:360:5)

#37 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1297:15)

#38 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1227:9)

#39 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1085:5)

#40 _invoke (dart:ui/hooks.dart:170:13)

#41 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:401:5)

#42 _drawFrame (dart:ui/hooks.dart:140:31)

 

답변 2

0

김지현님의 프로필 이미지
김지현
질문자

아! 넵 해결했습니다, 감사합니다:)

0

코드팩토리님의 프로필 이미지
코드팩토리
지식공유자

안녕하세요!

에러 메세지를 보니 아마 dispose() 함수를 선언하면서 super.dispose() 함수 실행을 깜빡 하신 것 같습니다.

초급 라이프 사이클 강의에서 알려드린 것 처럼 dispose() 함수를 오버라이드 할 경우 꼭 super.dispose()를 실행 해주셔야합니다.

감사합니다!

김지현님의 프로필 이미지
김지현

작성한 질문수

질문하기