Index: pkg/analysis_server/lib/src/services/correction/util.dart |
diff --git a/pkg/analysis_server/lib/src/services/correction/util.dart b/pkg/analysis_server/lib/src/services/correction/util.dart |
index 837afd85b65f5a8466b7e8299d91fa1a522a0403..2400e3f32c56680262a90a1ae831811a300906ab 100644 |
--- a/pkg/analysis_server/lib/src/services/correction/util.dart |
+++ b/pkg/analysis_server/lib/src/services/correction/util.dart |
@@ -934,6 +934,7 @@ class CorrectionUtils { |
/** |
* Returns the source to reference [type] in this [CompilationUnit]. |
+ * May return `null` if [type] does not have a source. |
* |
* Fills [librariesToImport] with [LibraryElement]s whose elements are |
* used by the generated source, but not imported. |
@@ -944,6 +945,10 @@ class CorrectionUtils { |
if (type is FunctionType && type.element is! FunctionTypeAliasElement) { |
return "Function"; |
} |
+ // dynamic or BottomType |
+ if (type.isDynamic || type.isBottom) { |
+ return null; |
+ } |
// prepare element |
Element element = type.element; |
if (element == null) { |