Skip to main content

Find and fix
problems in your code

Advanced linter
for Flutter development teams.

Used by amazing teams

350+ unique configurable rules

dart_code_metrics:
  rules:
    - avoid-unused-parameters
    - avoid-unrelated-type-assertions
    - prefer-return-await
    - always-remove-listener
    - use-setstate-synchronously
    - avoid-incomplete-copy-with
    - dispose-fields
    - proper-super-calls
    - avoid-redundant-async

Quick fixes

  • Quick Fix...
  • Move first
  • Ignore proper-super-calls for this line
  • Ignore proper-super-calls for the entire file
  • Fix all auto-fixable problems
  • Extract...
  • Extract Method
  • Wrap With ...

Unused code and files detection

$: dcm check-unused-code lib

✔ Analysis is completed.

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 class SomeClass
    at /path/to/file.dart:8:1

22+ code metrics

dart_code_metrics:
  metrics:
    cyclomatic-complexity: 20
    number-of-parameters: 4
    maximum-nesting-level: 5
    widgets-nesting-level: 5
    number-of-used-widgets: 20
    depth-of-inheritance-tree: 3
    number-of-imports: 10
    maintainability-index: 50
    halstead-volume: 150

Used by amazing teams

Make fewer mistakes and speed up code reviews

DCM helps you spend less time on searching and fixing bugs, so you can focus more on what matters:
building great software.

1class _MyWidgetState extends State<MyWidget> {
2  
3  Widget build(BuildContext context) {
4    setState(() {
5      myState = "Hello, Flutter!";
6    });
7
8    return Text(myState);
9  }
10}
WARNING  Avoid calling unnecessary setState.
         at example.dart
         avoid-unnecessary-setstate

Detect
problems

Find issues with 350+ unique lints

DCM statically analyzes your code with lint rules to quickly find problems and suggests fixes. The rules provided by DCM are not available in the built-in Dart SDK linter, but they are very handy.

Configure rules

All rules provided by DCM can be configured, so you can customize them to work exactly the way you need for your projects. You can also use rule presets to always have up to date rules list.

Learn more

Apply
quick fixes

Via IDE code actions

Some rules provide a quick fix to help you address the issue faster. Applying several fixes at once via "fix all of type" or "fix all in a file" is also available.

From the console

To speed up issues resolution even more, quick fixes can be applied to the entire project via "dcm fix".

Learn more
$: dcm fix lib
Calculating fixes...
✅ Calculation is completed. Applying the results.

Detect
unused parts

$: dcm check-unused-code lib
Analyzing lib...
❌ total unused code (classes and functions) - 10

Unused code

Even though the Dart compiler might optimize your code and exclude unused parts, maintaining such code is still your burden.

To find unused code in your codebase, try check-unused-code.

Unused files

Want to be sure that all the files in your project are actually used? Try check-unused-files.

You will also get a separate warning about files that are used only in tests.

Unused localization

Want to reduce your app bundle and amount of work for your localization team? Check if any localization in your codebase is unused.

Learn more

Calculate
metrics

For existing projects

Helps detect places in the codebase that need the most attention in terms of complexity / tech debt.

For new projects

Provides instant feedback on pull requests, helping to ensure that code stays easy to maintain.

Learn more
1dart_code_metrics:
2  metrics:
3    cyclomatic-complexity: 20
4    number-of-parameters: 4
5    maximum-nesting-level: 5
6    widgets-nesting-level: 5
7    number-of-used-widgets: 20
8    depth-of-inheritance-tree: 3

IDE integrations

Enable DCM for your favorite IDE.

What our users think

We're lucky to have a community that inspires us every day.
Read first-hand why people love DCM.

At Chili code quality is always a priority and adding DCM to our development flow elevated this process on several levels. Thanks to the abundant list of rules, a lot of potential problems are eliminated even before committing the code and getting to code review, which saves time and unnecessary back & forth. The DCM team is also very receptive to feedback and regularly releases new rules, as well as helps us with any issues. Our whole team is happy and unanimously agrees that DCM is a great productivity booster.

Daria Orlova
Mobile Tech Lead, Chili
On the Dart and Flutter DevTools team, we use DCM rules to continuously validate our code. A rule that was very valuable for our codebase was detection of dead code, as it keeps the codebase smaller and thus reduces maintenance cost. Other rules have improved our dev velocity by increasing code readability and making debugging easier.
Jacob Richman
Staff Tech Lead Manager, Google
DCM is a necessary tool for rapidly-scaling Flutter teams. As your codebase grows larger, it can become difficult to identify and eliminate unused code, unused localization strings, and violations of the team's best practices. By automating this maintenance, DCM significantly cuts down on the work needed to review pull requests. We now have high confidence in the quality and correctness of our code when we merge it.
Max Lapides
Mobile & Web Engineering, Aescape
As a Flutter competence lead in a scaling company, I've found DCM a must have tool in guiding our Flutter teams towards consistent coding practices and maintaining high coding standards. Shifting from manual coding convention documentation to DCM's approach, we've seen a remarkable improvement in both the efficiency of our code reviews and the onboarding process for new developers — a critical aspect for our rapidly scaling company. The real-time feedback through the IDE during the development phase and the tool's integration with our CI processes greatly enhanced code quality and team productivity. The DCM team's exceptional responsiveness and rapid adaptation to Flutter's evolving nature have been keeping us up to date with the latest developments.
Cagatay Ulusoy
Flutter Competence Lead, Wolt
We are truly impressed by the value that DCM rules bring to our codebase. They have successfully unified our code style, detected potential issues, and removed unnecessary code, leading to substantial maintenance cost reductions. We especially appreciate the availability of auto-fixes for many rules, which greatly facilitates the implementation of suggestions. For anyone serious about code quality, DCM is an absolute must. Highly recommended!
Honza Bittner
Flutter Developer, NetGlade
In my eyes, a strict linter is a must for any bigger team. It ensures a consistent code style and focuses code review on the important parts. We at Knowunity have used linting since day one and have always explored ways to make our linter even more powerful. DCM is the perfect tool to push linting to the next level. Especially, being able to check for unused code and unused localizations is crucial for an ever-changing big codebase.
Gregor Weber
Co-Founder & VP Mobile, Knowunity
The first time I'd tried to use DCM was long before it became Flutter Favorite. As a developer, I used it as an additional linter tool, promoted to Department Tech Lead, I used it as a tool to collect project metrics. At the moment DCM is a tool I try to have in any Flutter project, as well as personal and work, because it is a good supporter to write quality and reliable code. Additionally, it is important to highlight, that this project is all time being improved by its developers, who are open to feedback and suggestions of new features to make DCM better.
Mikhail Zotyev
"Oh, my Flutter" channel author, GDE
On the Dart and Flutter DevTools team, we use DCM rules to continuously validate our code. A rule that was very valuable for our codebase was detection of dead code, as it keeps the codebase smaller and thus reduces maintenance cost. Other rules have improved our dev velocity by increasing code readability and making debugging easier.
Jacob Richman
Staff Tech Lead Manager, Google
DCM is a great tool for people - and teams - who already know (or want to know) the benefits of a clean code base. Thanks to its helpful tools and broad set of rules you can get the best out of your coding experience, reduce bugs before they are even created and fix issues automatically. It's super easy to use and the support is outstanding! I don't want to miss it in my coding career anymore :)!
Verena Zaiser
Flutter Freelancer
DCM is the perfect tool if you want to standardize coding rules in your teams and ensure that everyone adheres to them. The DCM metrics that we collect monthly from our projects in the outsourcing company help us monitor the quality of all our diverse projects, as well as help gather data on technical debt in projects. The infrastructure allows you not to sweat the small stuff and see errors both in your favorite IDE and on CI/CD.
Mark Abramenko
Engineering Manager, Surf
What do you expect from a static analyzer? To save your time and to prevent bugs. DCM does that, plus it has great support, a crazy speed of delivering new features, and an exciting roadmap. Must-have for any team.
Kirill Bubochkin
Head of Mobile, Mews

How DCM can help
your team?

For Developers

  • Get fast feedback on your changes
  • Avoid debugging tricky bugs
  • Reduce the time spent on fixing bugs
  • Work with standardized code in all projects
  • Convince others to address tech debt

For Team Leads

  • Speed up code reviews
  • Gain visibility over codebase quality
  • Improve reliability
  • Improve release consistency
  • Speed up onboarding for new developers

For Stakeholders

  • Keep your users happy
  • Rework less, innovate more
  • Lower maintenance cost
  • Reduce operability risk, avoid business disruption
  • Improve release consistency
DCM

Ready to fix your code?

Start today