Skip to content
Back

Concurrent Modification Keep Popping Up

  • 0
  • Databases
  • Flutter
  • Cloud
Zionnite
16 May, 2024, 07:56

hello guys, i'm updating my Status Story when a user Click to view the Story, the User ID should be added to the array attribute in my DB Collection but this error keep popping out

here is the error output

TypeScript
flutter: Concurrent modification during iteration: _Map len:0.
flutter: 
#0      _CompactIterator.moveNext (dart:collection-patch/compact_hash.dart:714:7)
#1      RealtimeMixin._createSocket.<anonymous closure> (package:appwrite/src/realtime_mixin.dart:91:49)
#2      _RootZone.runGuarded (dart:async/zone.dart:1582:10)
#3      _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:392:13)
#4      _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:402:7)
#5      _BufferingStreamSubscription._close (dart:async/stream_impl.dart:291:7)
#6      _ForwardingStream._handleDone (dart:async/stream_pipe.dart:99:10)
#7      _ForwardingStreamSubscription._handleDone (dart:async/stream_pipe.dart:161:13)
#8      _RootZone.runGuarded (dart:async/zone.dart:1582:10)
#9      _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:392:13)
#10     _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:402:7)
#11     _BufferingStreamSubscription._close (dart:async/stream_impl.dart:291:7)
#12     _SyncStream<…>
flutter: ----------------------------------------------------```
TL;DR
Developers are encountering a "Concurrent modification during iteration" error in Flutter when updating a status story in the app. The issue seems to be related to adding user IDs to an array attribute in the database collection. The error message output suggests there is a problem with iterating over a map and modifying it simultaneously. Check the code related to creating sockets and ensure no modifications are being made during iteration. Review and refactor the code to handle array updates without causing concurrent modifications during iteration. Solution: - Refactor the code related to creating sockets to ensure no modifications are made during iterations.
Zionnite
16 May, 2024, 07:59

here is the Flutter Code ``````

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more