peng8350 / flutter_pulltorefresh

a widget provided to the flutter scroll component drop-down refresh and pull up load.
MIT License
2.7k stars 723 forks source link

结合scroll_to_index使用,报错 #465

Open catmaomao opened 3 years ago

catmaomao commented 3 years ago

I/flutter ( 4040): ══╡ EXCEPTION CAUGHT BY FOUNDATION LIBRARY ╞════════════════════════════════════════════════════════ I/flutter ( 4040): The following assertion was thrown while dispatching notifications for ValueNotifier: I/flutter ( 4040): Looking up a deactivated widget's ancestor is unsafe. I/flutter ( 4040): At this point the state of the widget's element tree is no longer stable. I/flutter ( 4040): To safely refer to a widget's ancestor in its dispose() method, save a reference to the ancestor by I/flutter ( 4040): calling dependOnInheritedWidgetOfExactType() in the widget's didChangeDependencies() method. I/flutter ( 4040): I/flutter ( 4040): When the exception was thrown, this was the stack: I/flutter ( 4040): #0 Element._debugCheckStateIsActiveForAncestorLookup. (package:flutter/src/widgets/framework.dart:3906:9) I/flutter ( 4040): #1 Element._debugCheckStateIsActiveForAncestorLookup (package:flutter/src/widgets/framework.dart:3920:6) I/flutter ( 4040): #2 Element.ancestorStateOfType (package:flutter/src/widgets/framework.dart:4026:12) I/flutter ( 4040): #3 SmartRefresher.ofState (package:pull_to_refresh/src/smart_refresher.dart:277:21) I/flutter ( 4040): #4 RefreshIndicatorState._handleModeChange (package:pull_to_refresh/src/internals/indicator_wrap.dart:244:24) I/flutter ( 4040): #5 ChangeNotifier.notifyListeners (package:flutter/src/foundation/change_notifier.dart:226:25) I/flutter ( 4040): #6 ValueNotifier.value= (package:flutter/src/foundation/change_notifier.dart:292:5) I/flutter ( 4040): #7 IndicatorStateMixin.initState (package:pull_to_refresh/src/internals/indicator_wrap.dart:651:59) I/flutter ( 4040): #8 GifHeaderState.initState (package:connect/ui/view/gif_header.dart:28:11) I/flutter ( 4040): #9 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4765:58) I/flutter ( 4040): #10 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4601:5) I/flutter ( 4040): #11 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3569:14) I/flutter ( 4040): #12 MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6236:32) I/flutter ( 4040): #13 _ViewportElement.mount (package:flutter/src/widgets/viewport.dart:225:11) 如果把listview中的controller去掉,就没问题不报错了,但存在时为什么会报这个错误?

peng8350 commented 3 years ago

试试新版本的,这个错误已经修复了的