Index: pkg/analyzer/lib/src/generated/constant.dart |
diff --git a/pkg/analyzer/lib/src/generated/constant.dart b/pkg/analyzer/lib/src/generated/constant.dart |
index d47db7daaf6125ff5af6684f9e86da752f15333a..b04f8198bdc87ec09780b1bb930e305342269dc2 100644 |
--- a/pkg/analyzer/lib/src/generated/constant.dart |
+++ b/pkg/analyzer/lib/src/generated/constant.dart |
@@ -776,12 +776,14 @@ class ConstantValueComputer { |
String fieldName = constructorFieldInitializer.fieldName.name; |
fieldMap[fieldName] = evaluationResult; |
PropertyAccessorElement getter = definingClass.getGetter(fieldName); |
- PropertyInducingElement field = getter.variable; |
- if (!evaluationResult.isNull && |
- !evaluationResult.type.isSubtypeOf(field.type)) { |
- errorReporter.reportErrorForNode( |
- CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_FIELD_TYPE_MISMATCH, |
- node, [evaluationResult.type, fieldName, field.type]); |
+ if (getter != null) { |
+ PropertyInducingElement field = getter.variable; |
+ if (!evaluationResult.isNull && |
+ !evaluationResult.type.isSubtypeOf(field.type)) { |
+ errorReporter.reportErrorForNode( |
+ CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_FIELD_TYPE_MISMATCH, |
+ node, [evaluationResult.type, fieldName, field.type]); |
+ } |
} |
} |
} else if (initializer is SuperConstructorInvocation) { |