dart-best-practices
General best practices for Dart development. Covers code style, effective Dart, and language features.
Guidelines for handling long lines in Dart code to adhere to the 80-column rule. The `lines_longer_than_80_chars` lint.
$ npx -y skills add kevmoo/dash_skills --skill dart-long-lines --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/dart-long-linesContext preview
The summary Claude sees to decide when to auto-load this skill.
Guidelines for handling long lines in Dart code to adhere to the 80-column rule. The `lines_longer_than_80_chars` lint.
name: dart-long-lines description: |- Guidelines for handling long lines in Dart code to adhere to the 80-column rule. The `lines_longer_than_80_chars` lint. license: Apache-2.0 key_features: - 80-column rule compliance - Line length refactoring - Linter rule enforcement
Use this skill when:
Reference: https://dart.dev/tools/linter-rules/lines_longer_than_80_chars
Do NOT break lines or alter code when:
or file paths where breaking them across lines would invalidate the link.
(`RegExp(r'...')`) where inserting whitespace or line breaks changes the matching semantics.
table rows, or ASCII diagrams inside comments or strings where wrapping lines destroys visual alignment.
running `dart format`. Let `dart format` handle code wrapping automatically; only manually wrap comments, docs, and multi-line strings that the formatter does not re-wrap.
To find lines that exceed the limit:
The most reliable way to find long lines is to use the Dart analyzer:
To search for long lines using regex:
Always run `dart format` before manually breaking long lines. The formatter often automatically fixes long lines, especially in generated code, and applies standard Dart styling rules.
Break long code comments (`//`) cleanly at word boundaries to ensure lines do not exceed 80 characters. Maintain tight formatting and avoid unnecessary vertical space.
`[text](http://example.com)` across lines. Place them on their own line if they exceed the limit.
before the rest of the comment. It is okay to break this first sentence across multiple lines to fit the 80-column limit.
strings. Break at word boundaries.
consecutive `print` statements, consider migrating to a multi-line string literal (`'''`).
`prefer_single_quotes` if a double-quoted string is split into parts that no longer contain single quotes).
**Avoid:**
/// This is a long doc comment that contains a link to [a very long /// URL](http://example.com/very/long/url/that/exceeds/eighty/chars).
**Prefer:**
/// This is a long doc comment that contains a link to [a very long URL][ref]. /// /// [ref]: http://example.com/very/long/url/that/exceeds/eighty/chars
**Prefer:**
final longString = 'This is a very long string that needs to be broken '
'across multiple lines to stay under the limit.';**Avoid:**
print('This is line 1\nThis is line 2 that is also quite long\nThis is line 3 which makes the whole thing exceed eighty characters');**Prefer:**
print('''This is line 1
This is line 2 that is also quite long
This is line 3 which makes the whole thing exceed eighty characters''');General best practices for Dart development. Covers code style, effective Dart, and language features.
Best practices for validating Dart documentation comments. Covers using `dart doc` to catch unresolved references and macros.
Best practices for using `expect` and `package:matcher`. Focuses on readable assertions, proper matcher selection, and avoiding…
Guidelines for using modern Dart features (v3.0 - v3.10) such as Records, Extension Types, Class Modifiers, Wildcards, Digit…
Guidelines and best practices for refactoring consecutive prints, single-line string concatenations, and complex output blocks…
Guidelines for maintaining external Dart packages, covering versioning, publishing workflows, and pull request management. Use…