@@ -28,7 +28,7 @@ import 'analyzer_plugin_utils.dart';
2828class ConnectRequiredProps extends RecursiveAstVisitor with ClassSuggestor {
2929 /// Running list of props that should be ignored per mixin that will all be added
3030 /// at the end in [generatePatches] .
31- final _ignoredPropsByMixin = < InterfaceElement , List <String >> {};
31+ final _ignoredPropsByMixin = < InterfaceElement , Set <String >> {};
3232
3333 @override
3434 visitCascadeExpression (CascadeExpression node) {
@@ -57,13 +57,7 @@ class ConnectRequiredProps extends RecursiveAstVisitor with ClassSuggestor {
5757
5858 // Keep a running list of props to ignore per props mixin.
5959 final fieldName = field.name.name;
60- if (_ignoredPropsByMixin[propsElement] != null ) {
61- if (! _ignoredPropsByMixin[propsElement]! .contains (fieldName)) {
62- _ignoredPropsByMixin[propsElement]! .add (fieldName);
63- }
64- } else {
65- _ignoredPropsByMixin[propsElement] = [fieldName];
66- }
60+ _ignoredPropsByMixin.putIfAbsent (propsElement, () => {}).add (fieldName);
6761 }
6862 }
6963
@@ -79,8 +73,7 @@ class ConnectRequiredProps extends RecursiveAstVisitor with ClassSuggestor {
7973
8074 // Add the patches at the end so that all the props to be ignored can be collected
8175 // from the different args in `connect` before adding patches to avoid duplicate patches.
82- for (final propsClass in _ignoredPropsByMixin.keys) {
83- final propsToIgnore = _ignoredPropsByMixin[propsClass]! ;
76+ _ignoredPropsByMixin.forEach ((propsClass, propsToIgnore) {
8477 final classNode =
8578 NodeLocator2 (propsClass.nameOffset).searchWithin (result.unit);
8679 if (classNode != null && classNode is NamedCompilationUnitMember ) {
@@ -131,7 +124,7 @@ class ConnectRequiredProps extends RecursiveAstVisitor with ClassSuggestor {
131124 }
132125 }
133126 }
134- }
127+ });
135128 }
136129
137130 static const connectArgNames = [
0 commit comments