Skip to main content

Format

Formats *.dart files.

To execute the command, run:

$ dcm format lib # or dcm fmt lib

Full command description:

Usage: dcm format [arguments] <directories>
-h, --help Print this usage information.


-l, --line-length Wrap lines longer than this.
-i, --indent Add this many spaces of leading indentation.
--cascading-widget-extensions Format widget extensions in a more readable way.


--dry-run Preview the proposed changes but make no changes.


-c, --print-config Print resolved config.


--root-folder=<./> Root folder.
(defaults to the current directory)
--sdk-path=<directory-path> Dart SDK directory path.
If the project has a `.fvm/flutter_sdk` symlink, it will be used if the SDK is not found.

--no-congratulate Don't show output even when there are no issues.


--ci-key The license key to run on CI server.
--email The email used to purchase the license.


--no-analytics Disable sending anonymous usage statistics.


--[no-]fatal-found Treat any formatting change as fatal.
(defaults to on)

Supported configuration​

To read more about the formatter configuration, refer to this page.

Dry run​

If you want to see the proposed changes without applying them, run the command with the --dry-run option. It will output the code that will be changed marking removed code with the red color and the code that will be added with the green.