微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

'package:flutter/src/widgets/framework.dart':断言失败:第 5098 行 pos 14:'_dependents.isEmpty':不是真的

如何解决'package:flutter/src/widgets/framework.dart':断言失败:第 5098 行 pos 14:'_dependents.isEmpty':不是真的

所以我使用节点 api 和提供程序包以及相关的新闻部分制作了一个带有评论流部分的新闻详细信息页面 当我尝试从相关新闻部分导航到另一篇文章时,问题就开始了,它给了我一个错误“状态不佳:已收听流”。当我尝试返回时,它给出了另一个错误

I/Flutter (25146): notsorted

[38;5;248m════════ Exception caught by widgets library ═══════════════════════════════════[39;49m
Bad state: Stream has already been listened to.
[38;5;244mThe relevant error-causing widget was[39;49m
[38;5;248mCommentstream[39;49m
 lib\screens\newsdetails.dart
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m
I/Flutter (25146): comment updated sucssefuly from api
I/Flutter (25146): loadcomments updated from provider

[38;5;248m════════ Exception caught by widgets library ═══════════════════════════════════[39;49m
Bad state: Stream has already been listened to.
[38;5;244mThe relevant error-causing widget was[39;49m
[38;5;248mCommentstream[39;49m
 lib\screens\newsdetails.dart
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m
I/Flutter (25146): comment updated sucssefuly from api
I/Flutter (25146): loadcomments updated from provider

[38;5;248m════════ Exception caught by widgets library ═══════════════════════════════════[39;49m
Bad state: Stream has already been listened to.
[38;5;244mThe relevant error-causing widget was[39;49m
[38;5;248mCommentstream[39;49m
 lib\screens\newsdetails.dart
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m
I/Flutter (25146): notsorted

[38;5;248m════════ Exception caught by widgets library ═══════════════════════════════════[39;49m
Bad state: Stream has already been listened to.
[38;5;244mThe relevant error-causing widget was[39;49m
[38;5;248mCommentstream[39;49m
 lib\screens\newsdetails.dart
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m
I/Flutter (25146): from comment newsdetails
I/Flutter (25146): notsorted

[38;5;248m════════ Exception caught by widgets library ═══════════════════════════════════[39;49m
Bad state: Stream has already been listened to.
[38;5;244mThe relevant error-causing widget was[39;49m
[38;5;248mCommentstream[39;49m
 lib\screens\newsdetails.dart
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m
I/Flutter (25146): notsorted

[38;5;248m════════ Exception caught by widgets library ═══════════════════════════════════[39;49m
Bad state: Stream has already been listened to.
[38;5;244mThe relevant error-causing widget was[39;49m
[38;5;248mCommentstream[39;49m
 lib\screens\newsdetails.dart
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m

[38;5;248m════════ Exception caught by widgets library ═══════════════════════════════════[39;49m
Bad state: Stream has already been listened to.
[38;5;244mThe relevant error-causing widget was[39;49m
[38;5;248mCommentstream[39;49m
 lib\screens\newsdetails.dart
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m
I/Flutter (25146): comment updated sucssefuly from api
I/Flutter (25146): loadcomments updated from provider

[38;5;248m════════ Exception caught by widgets library ═══════════════════════════════════[39;49m
Bad state: Stream has already been listened to.
[38;5;244mThe relevant error-causing widget was[39;49m
[38;5;248mCommentstream[39;49m
 lib\screens\newsdetails.dart
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m

[38;5;248m════════ Exception caught by widgets library ═══════════════════════════════════[39;49m
Bad state: Stream has already been listened to.
[38;5;244mThe relevant error-causing widget was[39;49m
[38;5;248mCommentstream[39;49m
 lib\screens\newsdetails.dart
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m
I/Flutter (25146): comment updated sucssefuly from api
I/Flutter (25146): loadcomments updated from provider

[38;5;248m════════ Exception caught by widgets library ═══════════════════════════════════[39;49m
Bad state: Stream has already been listened to.
[38;5;244mThe relevant error-causing widget was[39;49m
[38;5;248mCommentstream[39;49m
 lib\screens\newsdetails.dart
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m

[38;5;248m════════ Exception caught by widgets library ═══════════════════════════════════[39;49m
Bad state: Stream has already been listened to.
[38;5;244mThe relevant error-causing widget was[39;49m
[38;5;248mCommentstream[39;49m
 lib\screens\newsdetails.dart
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m
I/Flutter (25146): comment updated sucssefuly from api
I/Flutter (25146): loadcomments updated from provider

[38;5;248m════════ Exception caught by widgets library ═══════════════════════════════════[39;49m
Bad state: Stream has already been listened to.
[38;5;244mThe relevant error-causing widget was[39;49m
[38;5;248mCommentstream[39;49m
 lib\screens\newsdetails.dart
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m

[38;5;248m════════ Exception caught by widgets library ═══════════════════════════════════[39;49m
Bad state: Stream has already been listened to.
[38;5;244mThe relevant error-causing widget was[39;49m
[38;5;248mCommentstream[39;49m
 lib\screens\newsdetails.dart
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m

[38;5;248m════════ Exception caught by widgets library ═══════════════════════════════════[39;49m
'package:Flutter/src/widgets/framework.dart': Failed assertion: line 5098 pos 14: '_dependents.isEmpty': is not true.
[38;5;244mThe relevant error-causing widget was[39;49m
[38;5;248mMaterialApp[39;49m
 lib\main.dart
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m
I/Flutter (25146): live match stayus code 200
I/Flutter (25146): {"success":false,"msg":"لا يوجد مبارايات الان !!!"}
I/Flutter (25146): FavLive send from api sucssefuly

[38;5;248m════════ Exception caught by widgets library ═══════════════════════════════════[39;49m
Bad state: Stream has already been listened to.
[38;5;244mThe relevant error-causing widget was[39;49m
[38;5;248mCommentstream[39;49m
 lib\screens\newsdetails.dart
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m
I/Flutter (25146): livegames updated from provider

[38;5;248m════════ Exception caught by widgets library ═══════════════════════════════════[39;49m
'package:Flutter/src/widgets/framework.dart': Failed assertion: line 5098 pos 14: '_dependents.isEmpty': is not true.
[38;5;244mThe relevant error-causing widget was[39;49m
[38;5;248mMaterialApp[39;49m
 lib\main.dart
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m
I/Flutter (25146): trend api activated
I/Flutter (25146): news api activated
I/Flutter (25146): 9
I/Flutter (25146): notsorted
I/chatty  (25146): uid=10459(com.gulfgoal.gulf_goal) 1.ui identical 9 lines
I/Flutter (25146): notsorted
I/Flutter (25146): 25
I/Flutter (25146): notsorted

[38;5;248m════════ Exception caught by scheduler library ═════════════════════════════════[39;49m
Tried to build dirty widget in the wrong build scope.
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m

[38;5;248m════════ Exception caught by widgets library ═══════════════════════════════════[39;49m
Duplicate GlobalKeys detected in widget tree.
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m
I/Flutter (25146): trend api activated
I/Flutter (25146): news api activated
I/Flutter (25146): 9
I/Flutter (25146): notsorted
I/chatty  (25146): uid=10459(com.gulfgoal.gulf_goal) 1.ui identical 9 lines
I/Flutter (25146): notsorted
I/Flutter (25146): 25
I/Flutter (25146): notsorted

[38;5;248m════════ Exception caught by widgets library ═══════════════════════════════════[39;49m
Duplicate GlobalKeys detected in widget tree.
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m
I/Flutter (25146): from comment newsdetails
E/Flutter (25146): [ERROR:Flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: Looking up a deactivated widget's ancestor is unsafe.
E/Flutter (25146): At this point the state of the widget's element tree is no longer stable.
E/Flutter (25146): 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.
[38;5;244mE/Flutter (25146): #0      Element._debugCheckStateIsActiveForAncestorLookup.<anonymous closure>[39;49m
 package:Flutter/…/widgets/framework.dart
[38;5;244mE/Flutter (25146): #1      Element._debugCheckStateIsActiveForAncestorLookup[39;49m
 package:Flutter/…/widgets/framework.dart
[38;5;244mE/Flutter (25146): #2      Element.getElementForInheritedWidgetofExactType[39;49m
 package:Flutter/…/widgets/framework.dart
[38;5;244mE/Flutter (25146): #3      Provider._inheritedElementOf[39;49m
 package:provider/src/provider.dart
[38;5;244mE/Flutter (25146): #4      Provider.of[39;49m
 package:provider/src/provider.dart
[38;5;248mE/Flutter (25146): #5      _CommentstreamState.isstrem.<anonymous closure>[39;49m
 package:gulfgoal/components/commentstream.dart
[38;5;244mE/Flutter (25146): #6      State.setState[39;49m
 package:Flutter/…/widgets/framework.dart
[38;5;248mE/Flutter (25146): #7      _CommentstreamState.isstrem[39;49m
 package:gulfgoal/components/commentstream.dart
[38;5;248mE/Flutter (25146): #8      _CommentstreamState.initState.<anonymous closure>[39;49m
 package:gulfgoal/components/commentstream.dart
[38;5;244mE/Flutter (25146): #9      _rootRunUnary (dart:async/zone.dart:1198:47)[39;49m
[38;5;244mE/Flutter (25146): #10     _CustomZone.runUnary (dart:async/zone.dart:1100:19)[39;49m
[38;5;244mE/Flutter (25146): #11     _CustomZone.runUnaryguarded (dart:async/zone.dart:1005:7)[39;49m
[38;5;244mE/Flutter (25146): #12     _CustomZone.bindUnaryCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1042:26)[39;49m
[38;5;244mE/Flutter (25146): #13     _rootRunUnary (dart:async/zone.dart:1206:13)[39;49m
[38;5;244mE/Flutter (25146): #14     _CustomZone.runUnary (dart:async/zone.dart:1100:19)[39;49m
[38;5;244mE/Flutter (25146): #15     _CustomZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:1026:26)[39;49m
[38;5;244mE/Flutter (25146): #16     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:397:19)[39;49m
[38;5;244mE/Flutter (25146): #17     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:428:5)[39;49m
[38;5;244mE/Flutter (25146): #18     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)[39;49m
E/Flutter (25146):
I/Flutter (25146): 200
I/Flutter (25146): 9
I/Flutter (25146): notsorted
I/chatty  (25146): uid=10459(com.gulfgoal.gulf_goal) 1.ui identical 9 lines
I/Flutter (25146): notsorted
I/Flutter (25146): 25
I/Flutter (25146): notsorted
I/Flutter (25146): from comment newsdetails
E/Flutter (25146): [ERROR:Flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: Looking up a deactivated widget's ancestor is unsafe.
E/Flutter (25146): At this point the state of the widget's element tree is no longer stable.
E/Flutter (25146): 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.
[38;5;244mE/Flutter (25146): #0      Element._debugCheckStateIsActiveForAncestorLookup.<anonymous closure>[39;49m
 package:Flutter/…/widgets/framework.dart
[38;5;244mE/Flutter (25146): #1      Element._debugCheckStateIsActiveForAncestorLookup[39;49m
 package:Flutter/…/widgets/framework.dart
[38;5;244mE/Flutter (25146): #2      Element.getElementForInheritedWidgetofExactType[39;49m
 package:Flutter/…/widgets/framework.dart
[38;5;244mE/Flutter (25146): #3      Provider._inheritedElementOf[39;49m
 package:provider/src/provider.dart
[38;5;244mE/Flutter (25146): #4      Provider.of[39;49m
 package:provider/src/provider.dart
[38;5;248mE/Flutter (25146): #5      _CommentstreamState.isstrem.<anonymous closure>[39;49m
 package:gulfgoal/components/commentstream.dart
[38;5;244mE/Flutter (25146): #6      State.setState[39;49m
 package:Flutter/…/widgets/framework.dart
[38;5;248mE/Flutter (25146): #7      _CommentstreamState.isstrem[39;49m
 package:gulfgoal/components/commentstream.dart
[38;5;248mE/Flutter (25146): #8      _CommentstreamState.initState.<anonymous closure>[39;49m
 package:gulfgoal/components/commentstream.dart
[38;5;244mE/Flutter (25146): #9      _rootRunUnary (dart:async/zone.dart:1198:47)[39;49m
[38;5;244mE/Flutter (25146): #10     _CustomZone.runUnary (dart:async/zone.dart:1100:19)[39;49m
[38;5;244mE/Flutter (25146): #11     _CustomZone.runUnaryguarded (dart:async/zone.dart:1005:7)[39;49m
[38;5;244mE/Flutter (25146): #12     _CustomZone.bindUnaryCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1042:26)[39;49m
[38;5;244mE/Flutter (25146): #13     _rootRunUnary (dart:async/zone.dart:1206:13)[39;49m
[38;5;244mE/Flutter (25146): #14     _CustomZone.runUnary (dart:async/zone.dart:1100:19)[39;49m
[38;5;244mE/Flutter (25146): #15     _CustomZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:1026:26)[39;49m
[38;5;244mE/Flutter (25146): #16     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:397:19)[39;49m
[38;5;244mE/Flutter (25146): #17     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:428:5)[39;49m
[38;5;244mE/Flutter (25146): #18     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)[39;49m
E/Flutter (25146):
I/Flutter (25146): live match stayus code 200
I/Flutter (25146): {"success":false,"msg":"لا يوجد مبارايات الان !!!"}
I/Flutter (25146): FavLive send from api sucssefuly
I/Flutter (25146): livegames updated from provider
I/Flutter (25146): from comment newsdetails
E/Flutter (25146): [ERROR:Flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: Looking up a deactivated widget's ancestor is unsafe.
E/Flutter (25146): At this point the state of the widget's element tree is no longer stable.
E/Flutter (25146): 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.
[38;5;244mE/Flutter (25146): #0      Element._debugCheckStateIsActiveForAncestorLookup.<anonymous closure>[39;49m
 package:Flutter/…/widgets/framework.dart
[38;5;244mE/Flutter (25146): #1      Element._debugCheckStateIsActiveForAncestorLookup[39;49m
 package:Flutter/…/widgets/framework.dart
[38;5;244mE/Flutter (25146): #2      Element.getElementForInheritedWidgetofExactType[39;49m
 package:Flutter/…/widgets/framework.dart
[38;5;244mE/Flutter (25146): #3      Provider._inheritedElementOf[39;49m
 package:provider/src/provider.dart
[38;5;244mE/Flutter (25146): #4      Provider.of[39;49m
 package:provider/src/provider.dart
[38;5;248mE/Flutter (25146): #5      _CommentstreamState.isstrem.<anonymous closure>[39;49m
 package:gulfgoal/components/commentstream.dart
[38;5;244mE/Flutter (25146): #6      State.setState[39;49m
 package:Flutter/…/widgets/framework.dart
[38;5;248mE/Flutter (25146): #7      _CommentstreamState.isstrem[39;49m
 package:gulfgoal/components/commentstream.dart
[38;5;248mE/Flutter (25146): #8      _CommentstreamState.initState.<anonymous closure>[39;49m
 package:gulfgoal/components/commentstream.dart
[38;5;244mE/Flutter (25146): #9      _rootRunUnary (dart:async/zone.dart:1198:47)[39;49m
[38;5;244mE/Flutter (25146): #10     _CustomZone.runUnary (dart:async/zone.dart:1100:19)[39;49m
[38;5;244mE/Flutter (25146): #11     _CustomZone.runUnaryguarded (dart:async/zone.dart:1005:7)[39;49m
[38;5;244mE/Flutter (25146): #12     _CustomZone.bindUnaryCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1042:26)[39;49m
[38;5;244mE/Flutter (25146): #13     _rootRunUnary (dart:async/zone.dart:1206:13)[39;49m
[38;5;244mE/Flutter (25146): #14     _CustomZone.runUnary (dart:async/zone.dart:1100:19)[39;49m
[38;5;244mE/Flutter (25146): #15     _CustomZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:1026:26)[39;49m
[38;5;244mE/Flutter (25146): #16     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:397:19)[39;49m
[38;5;244mE/Flutter (25146): #17     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:428:5)[39;49m
[38;5;244mE/Flutter (25146): #18     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)[39;49m
E/Flutter (25146):

解决方法

热重启可能会修复此“_dependents.isEmpty”错误。如果没有解决,您必须发布您正在收听的流的代码。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。