avoid_commented_out_code
v0.3.0 Warning Fix Code Quality
Flags comments that look like commented-out Dart code rather than descriptive text. This includes commented-out function definitions, variable declarations, import statements, and other recognizable code patterns. The quick fix removes the flagged comment block.
Why use this rule
Section titled “Why use this rule”Commented-out code is technical debt that clutters the codebase and confuses readers about what is intentional. Version control already preserves old code, making commented-out blocks unnecessary. Removing them keeps the codebase clean and reduces cognitive load during code review.
See also: Effective Dart: Documentation
class BadExamples { // void apply(String value) { // print(value); // }
// final x = 42;
// import 'dart:async';
void another() {}}class GoodExamples { // This method handles the main processing logic // and delegates to the appropriate handler
// Temporarily disabled, enable in 1.0 void another() {}}Configuration
Section titled “Configuration”To disable this rule:
plugins: many_lints: diagnostics: avoid_commented_out_code: false