dart-documentation
Documenting Dart Code
Contents
- Core Principles
- Formatting Doc Comments
- Documenting Specific Constructs
- Workflow: Generating and Validating Docs
- Examples
Core Principles
- Use
///exclusively: Document members and types using///. Never use/** ... */block comments for documentation. - Use
//for internal comments: Use standard//comments for implementation details that should not appear in generated public documentation. - Format as sentences: Capitalize the first word (unless it is a case-sensitive identifier) and end with a period.
- Prefer brevity: Be clear, precise, and terse. Avoid redundant information that can be inferred from the method signature or class name.
- Use Markdown: Utilize standard Markdown for formatting. Prefer backtick fences (```) for code blocks over indentation. Avoid HTML tags.
Formatting Doc Comments
- Start with a summary: Begin the first sentence with a brief, third-person singular summary.
More from dart-lang/skills
dart-add-unit-test
Write and organize unit tests for functions, methods, and classes using `package:test`. Use when creating new logic or fixing bugs to ensure code remains correct and regression-free.
2.0Kdart-fix-runtime-errors
Uses get_runtime_errors and lsp to fetch an active stack trace, locate the failing line, apply a fix, and verify resolution via hot_reload.
2.0Kdart-run-static-analysis
Execute `dart analyze` to identify warnings and errors, and use `dart fix --apply` to automatically resolve mechanical lint issues. Use during development to ensure code quality and before committing changes.
2.0Kdart-use-pattern-matching
Use switch expressions and pattern matching where appropriate
2.0Kdart-resolve-package-conflicts
Workflow for fixing package version conflicts. Use this when `pub get` fails due to incompatible package versions.
2.0Kdart-collect-coverage
Collect coverage using the coverage packge and create an LCOV report
2.0K