CarGuo/gsy_github_app_flutter

网路超时报错

hanshengjian opened this issue · 0 comments

在趋势页面,选择一个语言的时候,网络超时,应该toast提示,但是遇到了报错,并且页面无提示,经过调试报错信息:
2023-03-26 13:35:46.217 32509-32559/com.shuyu.gsygithub.gsygithubappflutter I/flutter: Looking up a deactivated widget's ancestor is unsafe.
At this point the state of the widget's element tree is no longer stable.
To safely refer to a widget's ancestor in its dispose() method, save a reference to the ancestor by calling dependOnInheritedWidgetOfExactType() in the widget's didChangeDependencies() method.
2023-03-26 13:35:46.219 32509-32559/com.shuyu.gsygithub.gsygithubappflutter I/flutter: #0 Element._debugCheckStateIsActiveForAncestorLookup. (package:flutter/src/widgets/framework.dart:4241:9)
#1 Element._debugCheckStateIsActiveForAncestorLookup (package:flutter/src/widgets/framework.dart:4255:6)
#2 Element.dependOnInheritedWidgetOfExactType (package:flutter/src/widgets/framework.dart:4275:12)
#3 Localizations.of (package:flutter/src/widgets/localizations.dart:472:48)
#4 GSYLocalizations.i18n (package:gsy_github_app_flutter/common/localization/default_localizations.dart:35:27)
#5 HttpErrorListener.errorHandleFunction (package:gsy_github_app_flutter/app.dart:188:36)
#6 HttpErrorListener.initState. (package:gsy_github_app_flutter/app.dart:155:7)
#7 _rootRunUnary (dart:async/zone.dart:1399:47)
#8 _CustomZone.runUnary (dart:async/zone.dart:1300:19)
#9 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1209:7)
#10 CastStreamSubscription._onData (dart:_internal/async_cast.dart:85:11)

调试时发现,调用errorHandleFunction时,HttpErrorListener._context的_lifiesycleState状态是_ElementLifecycle.defunct,并且绑定_widget=null,貌似Element被卸载了
无法贴图,_context的信息我截图了,需要的话可以提供