Formatter
DCM provides a configurable formatter that supports project-wide configuration.
The configuration is used by both the IDE and the dcm format command.
This formatter is a modification of the dart_style library that supports extended configurability. All credit belongs to the authors of that library.
Configuration​
dcm:
  formatter:
    indent: 0
    line-length: 100
    cascading-widget-extensions: true
If you are using the Dart formatter configuration for the line length (page_width), it will be picked up and will have higher priority than line-length.
Indent​
Specify the number of spaces per indentation-level (the default indentation-level value is 0).
Line Length​
Specify the line length that the formatter will wrap on (the default value is 80).
For readability we recommend against using more than 120 characters.
Cascading Widget Extensions​
Specify whether the widget extensions inside a build method should be formatter in a more readable way.
Before:
Widget build(BuildContext context) {
  MyWidget().extensionMethod().another();
  ...
  MyWidget()
      .extensionMethod()
      .another()
      .andAnotherOne()
      .andAnotherOne()
      .andAnotherOne()
      .andAnotherOne();
  ...
}
After:
Widget build(BuildContext context) {
  MyWidget()
    .extensionMethod()
    .another();
  ...
  MyWidget()
    .extensionMethod()
    .another()
    .andAnotherOne()
    .andAnotherOne()
    .andAnotherOne()
    .andAnotherOne();
  ...
}
Enabling pre-Dart 3.7 Formatter​
To enable the old formatter for CLI, pass the --old-formatter flag. For the IDE integration, enable the corresponding extension setting in the configuration options.
VS Code Integration​
To enable the formatter in VS Code, pick DCM as the default formatter in the settings.json and enable the format on save option.
You can also use a separate command DCM: Format Current File.
IntelliJ / AS Integration​
You can format a file with the DCM: Format Current File command.