From 0628a1fb24f005e22181c700edc088cafe068157 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Thu, 7 Jun 2018 16:45:09 -0700 Subject: [PATCH] Eliminiate concurrent map key set modification (#18284) Iterates over a copy of the dirty entries list rather than the original, in order to avoid the potential for a concurrent modification exception when fileUris are removed/added later in the loop. This occurs when non-asset URIs (Dart sources) are listed in the dirty set when --preview-dart-2 is enabled (the default). --- packages/flutter_tools/lib/src/devfs.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/flutter_tools/lib/src/devfs.dart b/packages/flutter_tools/lib/src/devfs.dart index 475c7f98b0..dc401b8f92 100644 --- a/packages/flutter_tools/lib/src/devfs.dart +++ b/packages/flutter_tools/lib/src/devfs.dart @@ -485,7 +485,7 @@ class DevFS { // that it is initiated by user key press). final List invalidatedFiles = []; final Set filesUris = new Set(); - for (Uri uri in dirtyEntries.keys) { + for (Uri uri in dirtyEntries.keys.toList()) { if (!uri.path.startsWith(assetBuildDirPrefix)) { final DevFSContent content = dirtyEntries[uri]; if (content is DevFSFileContent) {