Index: pkg/analyzer/lib/src/task/strong/checker.dart |
diff --git a/pkg/analyzer/lib/src/task/strong/checker.dart b/pkg/analyzer/lib/src/task/strong/checker.dart |
index 491b50a6703913089c0f861a7cca12038e01a1b4..b9918a0e8390f53ff9fdfe28bbe61c18ba4e3a84 100644 |
--- a/pkg/analyzer/lib/src/task/strong/checker.dart |
+++ b/pkg/analyzer/lib/src/task/strong/checker.dart |
@@ -147,13 +147,14 @@ class CodeChecker extends RecursiveAstVisitor { |
final TypeProvider typeProvider; |
final AnalysisErrorListener reporter; |
final AnalysisOptionsImpl _options; |
+ final bool _hasFlutterDependency; |
_OverrideChecker _overrideChecker; |
bool _failure = false; |
bool _hasImplicitCasts; |
CodeChecker(TypeProvider typeProvider, StrongTypeSystemImpl rules, |
- AnalysisErrorListener reporter, this._options) |
+ AnalysisErrorListener reporter, this._options, this._hasFlutterDependency) |
: typeProvider = typeProvider, |
rules = rules, |
reporter = reporter { |
@@ -1111,6 +1112,17 @@ class CodeChecker extends RecursiveAstVisitor { |
} |
} |
+ // BUG(28588): The down-cast-composite warning will be turned off by |
+ // default, but as a first step we're only doing this for Flutter code |
+ // and we will leave it on for web projects to help with the migration |
+ // to strong mode and the associate runtime type checks. Flutter projects |
+ // can still turn on the warning explicitly through analysis options. |
+ if (_hasFlutterDependency && downCastComposite) { |
+ bool hasExplicitOption = _options.errorProcessors.any( |
+ (processor) => processor.code == StrongModeCode.DOWN_CAST_COMPOSITE); |
+ if (!hasExplicitOption) return; |
+ } |
+ |
var parent = expr.parent; |
ErrorCode errorCode; |
if (downCastComposite) { |