Fix runtime cast failure when run in Dart 2 mode. (#702)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 43f6dca..19ed308 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,7 @@
* Add fix to remove `new` keywords.
* Add fix to remove unneeded `const` keywords.
* Uniformly format constructor invocations and other static method calls.
+* Don't crash when showing parse errors in Dart 2 mode (#697).
# 1.0.14
diff --git a/lib/src/exceptions.dart b/lib/src/exceptions.dart
index ba5aeb4..0474466 100644
--- a/lib/src/exceptions.dart
+++ b/lib/src/exceptions.dart
@@ -23,7 +23,7 @@
// In case we get a huge series of cascaded errors, just show the first few.
var shownErrors = errors;
- if (errors.length > 10) shownErrors = errors.take(10);
+ if (errors.length > 10) shownErrors = errors.take(10).toList();
for (var error in shownErrors) {
var source = error.source.contents.data;