Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Cannot add event after closing" exception #43

Open
jcblancomartinez opened this issue May 31, 2022 · 0 comments
Open

"Cannot add event after closing" exception #43

jcblancomartinez opened this issue May 31, 2022 · 0 comments

Comments

@jcblancomartinez
Copy link

jcblancomartinez commented May 31, 2022

Hi,

I'm getting the following exception:

I/flutter (14998): Bad state: Cannot add event after closing
I/flutter (14998): Bad state: Failed to load https://...

#0      _StreamController.add (dart:async/stream_controller.dart:595:24)
#1      ExtendedNetworkImageProvider._loadNetwork.<anonymous closure> (package:extended_image_library/src/_network_image_io.dart:243:29)
#2      consolidateHttpClientResponseBytes.<anonymous closure> (package:flutter/src/foundation/consolidate_response.dart:83:24)
#3      _rootRunUnary (dart:async/zone.dart:1434:47)
#4      _CustomZone.runUnary (dart:async/zone.dart:1335:19)
#5      _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
#6      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#7      _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#8      _ForwardingStreamSubscription._add (dart:async/stream_pipe.dart:123:11)
#9      _HandleErrorStream._handleData (dart:async/stream_pipe.dart:253:10)
#10     _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:153:13)
#11     _rootRunUnary (dart:async/zone.dart:1434:47)
#12     _CustomZone.runUnary (dart:async/zone.dart:1335:19)
#13     _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
#14     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#15     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#16     _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:774:19)
#17     _StreamController._add (dart:async/stream_controller.dart:648:7)
#18     _StreamController.add (dart:async/stream_controller.dart:596:5)
#19     _HttpParser._doParse (dart:_http/http_parser.dart:829:28)
#20     _HttpParser._parse (dart:_http/http_parser.dart:319:7)
#21     _HttpParser._onData (dart:_http/http_parser.dart:873:5)
#22     _rootRunUnary (dart:async/zone.dart:1434:47)
#23     _CustomZone.runUnary (dart:async/zone.dart:1335:19)
#24     _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
#25     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#26     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#27     _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:774:19)
#28     _StreamController._add (dart:async/stream_controller.dart:648:7)
#29     _StreamController.add (dart:async/stream_controller.dart:596:5)
#30     _Socket._onData (dart:io-patch/socket_patch.dart:2314:41)
#31     _rootRunUnary (dart:async/zone.dart:1434:47)
#32     _CustomZone.runUnary (dart:async/zone.dart:1335:19)
#33     _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
#34     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#35     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#36     _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:774:19)
#37     _StreamController._add (dart:async/stream_controller.dart:648:7)
#38     _StreamController.add (dart:async/stream_controller.dart:596:5)
#39     _RawSecureSocket._sendReadEvent (dart:io/secure_socket.dart:1107:19)
#40     _rootRun (dart:async/zone.dart:1418:47)
#41     _CustomZone.run (dart:async/zone.dart:1328:19)
#42     _CustomZone.runGuarded (dart:async/zone.dart:1236:7)
#43     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1276:23)
#44     _rootRun (dart:async/zone.dart:1426:13)
#45     _CustomZone.run (dart:async/zone.dart:1328:19)
#46     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:1

If my understanding is correct, I believe this close call on the StreamController should instead be placed at an upper level (here and here)to avoid calling add on a closed StreamController.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant