Skip to content

Commit

Permalink
Change effective dart rule about line length (#6404)
Browse files Browse the repository at this point in the history
Fixes #6142
  • Loading branch information
MaryaBelanger authored Feb 11, 2025
1 parent 9306a58 commit fd9665b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/content/effective-dart/style.md
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,8 @@ formatting the code by hand and trying to make it more readable. Think of
`dart format` as a partnership where you work together, sometimes iteratively,
to produce beautiful code.


### AVOID lines longer than 80 characters
<a id="avoid-lines-longer-than-80-characters"></a>
### PREFER lines 80 characters or fewer

{% render 'linter-rule-mention.md', rules:'lines_longer_than_80_chars' %}

Expand All @@ -469,7 +469,8 @@ compact. The main offender is usually `VeryLongCamelCaseClassNames`. Ask
yourself, "Does each word in that type name tell me something critical or
prevent a name collision?" If not, consider omitting it.

Note that `dart format` does 99% of this for you, but the last 1% is you.
Note that `dart format` defaults to 80 characters or fewer, though you can
[configure][] the default.
It does not split long string literals to fit in 80 columns,
so you have to do that manually.

Expand All @@ -481,6 +482,8 @@ an import or export), it may remain whole even if it causes the line to go over
because newlines are significant inside the string and splitting the lines into
shorter ones can alter the program.

[configure]: /tools/dart-format#configuring-formatter-page-width

<a id="do-use-curly-braces-for-all-flow-control-structures"></a>
### DO use curly braces for all flow control statements

Expand Down

0 comments on commit fd9665b

Please sign in to comment.