@@ -19,8 +19,8 @@ provide a list of paths to the desired files or directories.
19
19
### Specify one path
20
20
21
21
Provide the path to one file or directory.
22
- If you specify a directory, ` dart format ` affects only the files in the
23
- immediate directory; it doesn't recurse through subdirectories.
22
+ If you pass a directory path,
23
+ ` dart format ` recurses into its subdirectories as well .
24
24
25
25
** Example:** To format all the Dart files in or under the current directory:
26
26
@@ -66,21 +66,16 @@ so they can trigger another action in response to the exit code.
66
66
$ dart format -o none --set-exit-if-changed bin/my_app.dart
67
67
```
68
68
69
- ## Use trailing commas
69
+ ## What changes?
70
70
71
- Use optional trailing commas for better automatic formatting.
72
- Add a trailing comma at the end of parameter lists in functions, methods,
73
- and constructors.
74
- This helps the formatter insert the appropriate amount of line breaks for
75
- Dart-style code.
71
+ ` dart format ` makes the following formatting changes:
76
72
77
- ## Affects whitespace only
73
+ * Removes whitespace.
74
+ * Wraps every line to 80 characters long or shorter.
75
+ * Adds trailing commas to any argument or parameter list.
76
+ that splits across multiple lines, and removes them from ones that don't.
77
+ * Might move comments before or after a comma.
78
78
79
- To avoid making changes that might be unsafe,
80
- ` dart format ` only affects whitespace.
81
-
82
- There's a lot more to writing readable and
83
- consistent code than just whitespace, though.
84
79
To learn more about best practices for writing and styling Dart code,
85
80
check out the [ Dart style guide] [ ] .
86
81
@@ -94,6 +89,9 @@ use the `dart help` command or see the documentation for the
94
89
$ dart help format
95
90
```
96
91
92
+ Check out the [ formatter FAQ] [ ] for more context behind formatting decisions.
93
+
97
94
[ Dart style guide ] : /effective-dart/style
98
95
[ dart_style ] : {{site.pub-pkg}}/dart_style
99
96
[ dart-guidelines ] : /effective-dart/style#formatting
97
+ [ formatter FAQ ] : {{site.repo.dart.org}}/dart_style/wiki/FAQ
0 commit comments