Advanced linter
for Flutter and Dart
DCM helps your team move faster by unifying code style, reducing the time spent on code reviews, onboarding new team members, and finding and fixing tricky bugs.
Analyze
DCM is a tool to build maintainable software faster. It provides you with valuable insights that you didn't know about before. No AI hallucinations, purely statically available data that would take too long to collect manually.
1class _MyState extends State<MyWidget> {
2
3 Widget build(BuildContext context) {
4 setState(() {
5 myState = "Hello, Flutter!";
6 });
7
8 return Text(myState);
9 }
10}
Lint rules
Find bugs and style issues. Reduce routine.
1
2
3
4class MyCustomWidget extends StatefulWidget {
5 const MyCustomWidget({
6 super.key,
7 this.child,
8 this.titleBar,
9 this.sidebar,
10
Metrics
Get your projects complexity overview
Widget analysis
Ensure the highest quality of your widgets
$: dcm analyze-assets lib
assets/app-logo.png (2.41 KB, 204 x 27):
✘ this image name is in kebab-case. Try
renaming it to snake_case.
✘ this image size exceeds the 1KB limit.
✘ incorrect image format (.png). Convert
this image to webp to reduce its size.
Image assets analysis
Keep your "assets" folder maintainable
Project structure analysis
Quickly find how files depend on each other
Fix
DCM comes with powerful fixes that you can apply from both your favorite IDE and CLI. Violation preview helps you quickly choose new rules and find fixable issues that you can address right away. Everything to make you more productive.
- Quick Fix...
- Move first
- Ignore proper-super-calls for this line
- Ignore proper-super-calls for the entire file
- Fix all auto-fixable problems
- Fix all proper-super-calls problems
IDE quick fixes
Automatically fix highlighted fixable issues
$: dcm fix lib
Calculating fixes...
✅ Calculation is completed.
Applying the results.
CLI fixes
The fastest way to update your whole project
$: dcm init preview lib
/path/to/package:
rules:
- dispose-fields # 3 violations
- arguments-ordering # 2 violations
- prefer-trailing-comma # 1 violation
- avoid-unused-parameters # 1 violation
Violations preview
Your assistant in choosing new rules
Maintain
One way to move faster is to timely remove anything that slows you down in the long run. On top of that, removing unused code, files and localization helps you find unintentionally unused parts that are actually bugs.
$: dcm check-unused-code lib
lib/main.dart:
✘ unused function someFunction
at /path/to/file.dart:4:1
✘ unused top level variable someVar
at /path/to/file.dart:6:1
Unused code detection
Clean up with little effort
$: dcm check-unused-files lib
lib/main.dart:
✘ unused file
at /path/to/file.dart:4:1
✘ used only in tests
at /path/to/file.dart:6:1
Unused files detection
Throw away entire files? Why not
$: dcm check-parameters lib
lib/main.dart:
✘ method someMethod
has parameter issues
- (String? value) is unnecessary nullable
at /path/to/file.dart:4:1
Parameter issues detection
Simplify the inputs of your functions
$: dcm check-unused-l10n lib
class HomeI18n
✘ unused getter homeTab
at /path/to/file.dart:4:1
✘ unused getter profileTab
at /path/to/file.dart:6:1
Unused localization detection
Reduce your app bundle
$: dcm check-dependencies lib
pubspec.yaml:
✘ cupertino_icons is not used.
at /path/to/pubspec.yaml:4:1
✘ lints should be listed in dev dependencies.
at /path/to/pubspec.yaml:6:1
Misused dependencies detection
Timely remove unused external packages
$: dcm check-code-duplication lib
lib/main.dart:
✘ method someMethod
has 1 duplicate declaration:
- method anotherMethod
at /path/to/another_file.dart:6:1
Duplicate code detection
Easily find unwanted duplications
Configure
DCM is designed with your needs in mind. There is no code style that suits everyone. Choose the rules and metrics that will help you, and customize them so that they help you as effectively as possible.
analyzer:
exclude:
- build/**
dart_code_metrics:
rules:
- avoid-unused-parameters
- avoid-undisposed-instances
Familiar configuration file
Configuration that is easy to use
dart_code_metrics:
extends:
- recommended
- package:dart_code_metrics_presets/bloc.yaml
rules:
- no-empty-blocks: false
- avoid-shadowing:
ignore-static: true
Presets
Get started quickly and always stay up to date
"lib/main.dart": {
"prefer-match-file-name": [
"9075e416a7d67c2f6c7d9386dff2e591"
],
"avoid-unused-parameters": [
"808e0f8c9e3bc117072eebf4a25d51b6",
]
}
Baseline
Add to existing projects with ease
Integrate
DCM provides extensions for the most popular IDEs used by Dart and Flutter developers so you can get real-time feedback on code changes. And various CLI output formats and integrations provide the ultimate CI/CD experience.
IDE integration
Use in your favorite development environment
CI/CD integration
Ensure the highest quality of your main branch
Ready to fix your code?
Start today