Skip to main content

avoid-long-files

added in: 1.10.0
⚙️
Pro+

Warns when a file length (number of lines) exceeds the configured maximum.

Long files can be hard to read and maintain. Consider splitting them into several smaller files.

⚙️ Config

Set max-length (default is 500) to configure the number of lines after which the rule should trigger.

analysis_options.yaml
dart_code_metrics:
rules:
- avoid-long-files:
max-length: 500

Example

❌ Bad:

// number of lines exceeds the configured 500 lines

✅ Good:

// number of lines is below the configured 500 lines

Additional Resources