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

时间:2021-01-07 01:11:57

标签: flutter dart provider

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

I/flutter (25146): notsorted

════════ Exception caught by widgets library ═══════════════════════════════════
Bad state: Stream has already been listened to.
The relevant error-causing widget was
Commentstream
 lib\screens\newsdetails.dart
════════════════════════════════════════════════════════════════════════════════
I/flutter (25146): comment updated sucssefuly from api
I/flutter (25146): loadcomments updated from provider

════════ Exception caught by widgets library ═══════════════════════════════════
Bad state: Stream has already been listened to.
The relevant error-causing widget was
Commentstream
 lib\screens\newsdetails.dart
════════════════════════════════════════════════════════════════════════════════
I/flutter (25146): comment updated sucssefuly from api
I/flutter (25146): loadcomments updated from provider

════════ Exception caught by widgets library ═══════════════════════════════════
Bad state: Stream has already been listened to.
The relevant error-causing widget was
Commentstream
 lib\screens\newsdetails.dart
════════════════════════════════════════════════════════════════════════════════
I/flutter (25146): notsorted

════════ Exception caught by widgets library ═══════════════════════════════════
Bad state: Stream has already been listened to.
The relevant error-causing widget was
Commentstream
 lib\screens\newsdetails.dart
════════════════════════════════════════════════════════════════════════════════
I/flutter (25146): from comment newsdetails
I/flutter (25146): notsorted

════════ Exception caught by widgets library ═══════════════════════════════════
Bad state: Stream has already been listened to.
The relevant error-causing widget was
Commentstream
 lib\screens\newsdetails.dart
════════════════════════════════════════════════════════════════════════════════
I/flutter (25146): notsorted

════════ Exception caught by widgets library ═══════════════════════════════════
Bad state: Stream has already been listened to.
The relevant error-causing widget was
Commentstream
 lib\screens\newsdetails.dart
════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by widgets library ═══════════════════════════════════
Bad state: Stream has already been listened to.
The relevant error-causing widget was
Commentstream
 lib\screens\newsdetails.dart
════════════════════════════════════════════════════════════════════════════════
I/flutter (25146): comment updated sucssefuly from api
I/flutter (25146): loadcomments updated from provider

════════ Exception caught by widgets library ═══════════════════════════════════
Bad state: Stream has already been listened to.
The relevant error-causing widget was
Commentstream
 lib\screens\newsdetails.dart
════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by widgets library ═══════════════════════════════════
Bad state: Stream has already been listened to.
The relevant error-causing widget was
Commentstream
 lib\screens\newsdetails.dart
════════════════════════════════════════════════════════════════════════════════
I/flutter (25146): comment updated sucssefuly from api
I/flutter (25146): loadcomments updated from provider

════════ Exception caught by widgets library ═══════════════════════════════════
Bad state: Stream has already been listened to.
The relevant error-causing widget was
Commentstream
 lib\screens\newsdetails.dart
════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by widgets library ═══════════════════════════════════
Bad state: Stream has already been listened to.
The relevant error-causing widget was
Commentstream
 lib\screens\newsdetails.dart
════════════════════════════════════════════════════════════════════════════════
I/flutter (25146): comment updated sucssefuly from api
I/flutter (25146): loadcomments updated from provider

════════ Exception caught by widgets library ═══════════════════════════════════
Bad state: Stream has already been listened to.
The relevant error-causing widget was
Commentstream
 lib\screens\newsdetails.dart
════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by widgets library ═══════════════════════════════════
Bad state: Stream has already been listened to.
The relevant error-causing widget was
Commentstream
 lib\screens\newsdetails.dart
════════════════════════════════════════════════════════════════════════════════

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

════════ Exception caught by widgets library ═══════════════════════════════════
Bad state: Stream has already been listened to.
The relevant error-causing widget was
Commentstream
 lib\screens\newsdetails.dart
════════════════════════════════════════════════════════════════════════════════
I/flutter (25146): livegames updated from provider

════════ Exception caught by widgets library ═══════════════════════════════════
'package:flutter/src/widgets/framework.dart': Failed assertion: line 5098 pos 14: '_dependents.isEmpty': is not true.
The relevant error-causing widget was
MaterialApp
 lib\main.dart
════════════════════════════════════════════════════════════════════════════════
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

════════ Exception caught by scheduler library ═════════════════════════════════
Tried to build dirty widget in the wrong build scope.
════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by widgets library ═══════════════════════════════════
Duplicate GlobalKeys detected in widget tree.
════════════════════════════════════════════════════════════════════════════════
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

════════ Exception caught by widgets library ═══════════════════════════════════
Duplicate GlobalKeys detected in widget tree.
════════════════════════════════════════════════════════════════════════════════
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.
E/flutter (25146): #0      Element._debugCheckStateIsActiveForAncestorLookup.<anonymous closure>
 package:flutter/…/widgets/framework.dart
E/flutter (25146): #1      Element._debugCheckStateIsActiveForAncestorLookup
 package:flutter/…/widgets/framework.dart
E/flutter (25146): #2      Element.getElementForInheritedWidgetOfExactType
 package:flutter/…/widgets/framework.dart
E/flutter (25146): #3      Provider._inheritedElementOf
 package:provider/src/provider.dart
E/flutter (25146): #4      Provider.of
 package:provider/src/provider.dart
E/flutter (25146): #5      _CommentstreamState.isstrem.<anonymous closure>
 package:gulfgoal/components/commentstream.dart
E/flutter (25146): #6      State.setState
 package:flutter/…/widgets/framework.dart
E/flutter (25146): #7      _CommentstreamState.isstrem
 package:gulfgoal/components/commentstream.dart
E/flutter (25146): #8      _CommentstreamState.initState.<anonymous closure>
 package:gulfgoal/components/commentstream.dart
E/flutter (25146): #9      _rootRunUnary (dart:async/zone.dart:1198:47)
E/flutter (25146): #10     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
E/flutter (25146): #11     _CustomZone.runUnaryGuarded (dart:async/zone.dart:1005:7)
E/flutter (25146): #12     _CustomZone.bindUnaryCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1042:26)
E/flutter (25146): #13     _rootRunUnary (dart:async/zone.dart:1206:13)
E/flutter (25146): #14     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
E/flutter (25146): #15     _CustomZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:1026:26)
E/flutter (25146): #16     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:397:19)
E/flutter (25146): #17     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:428:5)
E/flutter (25146): #18     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
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.
E/flutter (25146): #0      Element._debugCheckStateIsActiveForAncestorLookup.<anonymous closure>
 package:flutter/…/widgets/framework.dart
E/flutter (25146): #1      Element._debugCheckStateIsActiveForAncestorLookup
 package:flutter/…/widgets/framework.dart
E/flutter (25146): #2      Element.getElementForInheritedWidgetOfExactType
 package:flutter/…/widgets/framework.dart
E/flutter (25146): #3      Provider._inheritedElementOf
 package:provider/src/provider.dart
E/flutter (25146): #4      Provider.of
 package:provider/src/provider.dart
E/flutter (25146): #5      _CommentstreamState.isstrem.<anonymous closure>
 package:gulfgoal/components/commentstream.dart
E/flutter (25146): #6      State.setState
 package:flutter/…/widgets/framework.dart
E/flutter (25146): #7      _CommentstreamState.isstrem
 package:gulfgoal/components/commentstream.dart
E/flutter (25146): #8      _CommentstreamState.initState.<anonymous closure>
 package:gulfgoal/components/commentstream.dart
E/flutter (25146): #9      _rootRunUnary (dart:async/zone.dart:1198:47)
E/flutter (25146): #10     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
E/flutter (25146): #11     _CustomZone.runUnaryGuarded (dart:async/zone.dart:1005:7)
E/flutter (25146): #12     _CustomZone.bindUnaryCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1042:26)
E/flutter (25146): #13     _rootRunUnary (dart:async/zone.dart:1206:13)
E/flutter (25146): #14     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
E/flutter (25146): #15     _CustomZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:1026:26)
E/flutter (25146): #16     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:397:19)
E/flutter (25146): #17     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:428:5)
E/flutter (25146): #18     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
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.
E/flutter (25146): #0      Element._debugCheckStateIsActiveForAncestorLookup.<anonymous closure>
 package:flutter/…/widgets/framework.dart
E/flutter (25146): #1      Element._debugCheckStateIsActiveForAncestorLookup
 package:flutter/…/widgets/framework.dart
E/flutter (25146): #2      Element.getElementForInheritedWidgetOfExactType
 package:flutter/…/widgets/framework.dart
E/flutter (25146): #3      Provider._inheritedElementOf
 package:provider/src/provider.dart
E/flutter (25146): #4      Provider.of
 package:provider/src/provider.dart
E/flutter (25146): #5      _CommentstreamState.isstrem.<anonymous closure>
 package:gulfgoal/components/commentstream.dart
E/flutter (25146): #6      State.setState
 package:flutter/…/widgets/framework.dart
E/flutter (25146): #7      _CommentstreamState.isstrem
 package:gulfgoal/components/commentstream.dart
E/flutter (25146): #8      _CommentstreamState.initState.<anonymous closure>
 package:gulfgoal/components/commentstream.dart
E/flutter (25146): #9      _rootRunUnary (dart:async/zone.dart:1198:47)
E/flutter (25146): #10     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
E/flutter (25146): #11     _CustomZone.runUnaryGuarded (dart:async/zone.dart:1005:7)
E/flutter (25146): #12     _CustomZone.bindUnaryCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1042:26)
E/flutter (25146): #13     _rootRunUnary (dart:async/zone.dart:1206:13)
E/flutter (25146): #14     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
E/flutter (25146): #15     _CustomZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:1026:26)
E/flutter (25146): #16     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:397:19)
E/flutter (25146): #17     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:428:5)
E/flutter (25146): #18     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
E/flutter (25146):

1 个答案:

答案 0 :(得分:1)

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