From 49f4f42b3f87884e51794a2912a60340b1e959b2 Mon Sep 17 00:00:00 2001 From: Tsavo Knott Date: Mon, 23 Feb 2026 19:26:23 -0500 Subject: [PATCH] fix: avoid deprecated LintCode name getters --- lib/custom_lints/prefer_for_in_over_foreach_lint.dart | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/custom_lints/prefer_for_in_over_foreach_lint.dart b/lib/custom_lints/prefer_for_in_over_foreach_lint.dart index c165b54..984c2c5 100644 --- a/lib/custom_lints/prefer_for_in_over_foreach_lint.dart +++ b/lib/custom_lints/prefer_for_in_over_foreach_lint.dart @@ -11,8 +11,10 @@ import 'package:custom_lint_builder/custom_lint_builder.dart' class PreferForInOverForEachLint extends DartLintRule { const PreferForInOverForEachLint() : super(code: _code); + static const _ruleName = 'prefer_for_in_over_foreach'; + static const _code = LintCode( - name: 'prefer_for_in_over_foreach', + name: _ruleName, problemMessage: 'Avoid using forEach with function literals. Prefer tear-offs, for-in loops, or collection for syntax. Function literals in forEach create unnecessary closures, add runtime overhead, and limit control flow (no break/continue).', correctionMessage: @@ -48,11 +50,7 @@ class PreferForInOverForEachLint extends DartLintRule { // Report with enhanced message reporter.atNode( node, - LintCode( - name: _code.lowerCaseName, - problemMessage: _code.problemMessage, - correctionMessage: refactoringSuggestion, - ), + LintCode(name: _ruleName, problemMessage: _code.problemMessage, correctionMessage: refactoringSuggestion), ); }); }