Closed kinex closed 7 months ago
The exception happens because the await
in line 92 makes it possible to call other methods for this instance while the loop is still being executed. Possible fix:
final exactPathCache = _streamCache[firestore]![path];
if (exactPathCache != null) {
for (final query in exactPathCache.keys.toList()) {
final streamController = exactPathCache[query];
if (streamController != null) {
await query.get().then(streamController!.add);
}
}
}
Amazing that you were able to track down this issue. Would you be able to contribute a PR? The hard part would be to write a test that reproduces the issue.
You can now get the fix at https://pub.dev/packages/fake_cloud_firestore/changelog#244. Thank you for your patience!
Exception:
ConcurrentModificationError (Concurrent modification during iteration: _LinkedHashMap len:3.)
Happens here:
..\pub.dartlang.org\fake_cloud_firestore-2.3.0+3\lib\src\query_snapshot_stream_manager.dart:91)