'package:flutter/src/widgets/framework.dart':断言失败:第 5098 行第 14 行:'_dependents.isEmpty':不正确

'package:flutter/src/widgets/framework.dart': Failed assertion: line 5098 pos 14: '_dependents.isEmpty': is not true

所以我使用节点 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”错误。如果没有解决,您必须 post 您正在收听的流的代码。