newline-before-constructor
Enforces a blank line before a constructor declaration.
⚙️ Config
Set ignore-redirecting (default is false) to exclude redirecting constructors.
analysis_options.yaml
dcm:
rules:
- newline-before-constructor:
ignore-redirecting: false
Example
❌ Bad:
class Wrong {
Wrong();
Wrong.first(); // LINT: Missing a blank line before this constructor declaration. Try adding it.
Wrong.second(); // LINT: Missing a blank line before this constructor declaration. Try adding it.
}
✅ Good:
class Wrong {
Wrong();
Wrong.first();
Wrong.second();
}