From 9b959b02f3f58f1e94a4de063bf7ec4c61025c7c Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Wed, 16 Feb 2022 11:04:41 -0800 Subject: [PATCH 1/2] enable the avoid_dynamic_calls lint --- CHANGELOG.md | 2 +- analysis_options.yaml | 3 +++ lib/src/equality.dart | 2 +- test/analysis_options.yaml | 6 ++++++ 4 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 test/analysis_options.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index 4cf1f64..5ebe8ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ Assignment to `Equality` with a nullable type is still allowed because of covariance. The `equals` and `hash` methods continue to accept nullable arguments. - +* Enable the `avoid_dynamic_calls` lint. ## 1.15.0 diff --git a/analysis_options.yaml b/analysis_options.yaml index d12202a..a7e3292 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,6 +1,9 @@ include: package:lints/recommended.yaml + linter: rules: + - avoid_dynamic_calls + # Errors - test_types_in_equals - throw_in_finally diff --git a/lib/src/equality.dart b/lib/src/equality.dart index 8f2d7d8..7adb845 100644 --- a/lib/src/equality.dart +++ b/lib/src/equality.dart @@ -212,7 +212,7 @@ abstract class _UnorderedEquality> bool equals(T? elements1, T? elements2) { if (identical(elements1, elements2)) return true; if (elements1 == null || elements2 == null) return false; - var counts = HashMap( + var counts = HashMap( equals: _elementEquality.equals, hashCode: _elementEquality.hash, isValidKey: _elementEquality.isValidKey); diff --git a/test/analysis_options.yaml b/test/analysis_options.yaml new file mode 100644 index 0000000..3d47f94 --- /dev/null +++ b/test/analysis_options.yaml @@ -0,0 +1,6 @@ +include: ../analysis_options.yaml + +# Turn off the avoid_dynamic_calls lint for the test/ directory. +analyzer: + errors: + avoid_dynamic_calls: ignore From 6ee5d26b524c4693a32d29ba87856c38070c63f5 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Wed, 16 Feb 2022 14:31:38 -0800 Subject: [PATCH 2/2] review comments --- lib/src/equality.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/equality.dart b/lib/src/equality.dart index 7adb845..a0db983 100644 --- a/lib/src/equality.dart +++ b/lib/src/equality.dart @@ -212,7 +212,7 @@ abstract class _UnorderedEquality> bool equals(T? elements1, T? elements2) { if (identical(elements1, elements2)) return true; if (elements1 == null || elements2 == null) return false; - var counts = HashMap( + var counts = HashMap( equals: _elementEquality.equals, hashCode: _elementEquality.hash, isValidKey: _elementEquality.isValidKey);