diff --git a/lib/src/rules/prefer_iterable_whereType.dart b/lib/src/rules/prefer_iterable_whereType.dart index 534ea476b..437bb8b52 100644 --- a/lib/src/rules/prefer_iterable_whereType.dart +++ b/lib/src/rules/prefer_iterable_whereType.dart @@ -49,7 +49,7 @@ class _Visitor extends SimpleAstVisitor { void visitMethodInvocation(MethodInvocation node) { if (node.methodName.name != 'where') return; if (!DartTypeUtilities.implementsInterface( - node.target.bestType, 'Iterable', 'dart.core')) { + node.realTarget.bestType, 'Iterable', 'dart.core')) { return; } diff --git a/test/rules/prefer_iterable_whereType.dart b/test/rules/prefer_iterable_whereType.dart index a81c37d91..80e8805bc 100644 --- a/test/rules/prefer_iterable_whereType.dart +++ b/test/rules/prefer_iterable_whereType.dart @@ -21,6 +21,7 @@ main() { return e is String; }); l.whereType(); // OK + []..add(0)..where((e) => true); // OK } bool p(e) => e is String;