{"slug":"dart-best-practices","title":"dart-best-practices","summary":"General best practices for Dart development. Covers code style, effective Dart, and language features.","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-09-14T18:30:23.132332Z","repo":{"url":"https://github.com/kevmoo/dash_skills","stars":146,"forks":16,"license":"Apache-2.0","updatedAt":"2026-09-24T00:03:49Z"},"bodyHtml":"<hr>\n<p>name: dart-best-practices\ndescription: |-\nGeneral best practices for Dart development.\nCovers code style, effective Dart, and language features.\nlicense: Apache-2.0\nkey_features:</p>\n<ul>\n<li>Code style guidelines</li>\n<li>Effective Dart idioms</li>\n<li>Language feature recommendations</li>\n</ul>\n<hr>\n<h1>Dart Best Practices</h1>\n<h2>1. When to use this skill</h2>\n<p>Use this skill when:</p>\n<ul>\n<li>Writing or reviewing Dart code.</li>\n<li>Looking for guidance on idiomatic Dart usage.</li>\n</ul>\n<h3>When NOT to use (Abstention Guardrails)</h3>\n<p>Do NOT apply this skill or refactor code when:</p>\n<ul>\n<li><strong>Public API Breaking Changes</strong>: Refactoring would alter public API contracts,\nreturn types, or parameter signatures in published packages without a\ncoordinated major SemVer bump.</li>\n<li><strong>Dogmatic Micro-Optimizations</strong>: Rewriting clear, readable code for\nnegligible theoretical gains (e.g. replacing clear string concatenation in a\nsimple one-line log message with multiline quotes).</li>\n<li><strong>Domain-Specific or Code-Generated Files</strong>: Generated files (<code>*.g.dart</code>,\n<code>*.freezed.dart</code>, protobufs) or files where line lengths and string layouts\nare managed by code generators.</li>\n<li><strong>Explicit Type Annotations in Public Interfaces</strong>: Replacing explicit type\nannotations with <code>var</code> or <code>final</code> where explicit types document the public API\nsurface or disambiguate complex generics.</li>\n</ul>\n<h2>2. Best Practices</h2>\n<h3>Multi-line Strings</h3>\n<p>Prefer using multi-line strings (<code>'''</code>) over concatenating strings with <code>+</code> and\n<code>\\n</code>, especially for large blocks of text like SQL queries, HTML, or PEM-encoded\nkeys. This improves readability and avoids <code>lines_longer_than_80_chars</code> lint\nerrors by allowing natural line breaks.</p>\n<p><strong>Avoid:</strong></p>\n<pre><code>final pem = '-----BEGIN RSA PRIVATE KEY-----\\n' +\n    base64Encode(fullBytes) +\n    '\\n-----END RSA PRIVATE KEY-----';\n</code></pre>\n<p><strong>Prefer:</strong></p>\n<pre><code>final pem = '''\n-----BEGIN RSA PRIVATE KEY-----\n${base64Encode(fullBytes)}\n-----END RSA PRIVATE KEY-----''';\n</code></pre>\n<h3>Line Length</h3>\n<p>Avoid lines longer than 80 characters, even in Markdown files and comments. This\nensures code is readable in split-screen views and on smaller screens without\nhorizontal scrolling.</p>\n<p><strong>Prefer:</strong> Target 80 characters for wrapping text. Exceptions are allowed for\nlong URLs or identifiers that cannot be broken.</p>\n<h2>Discovery</h2>\n<h3>Multi-line Strings</h3>\n<p>To find candidates for multi-line strings, search for string concatenation with\n<code>+</code> involving newlines:</p>\n<ul>\n<li><strong>Regex</strong>: <code>['\"]\\s*\\+\\s*['\"]</code></li>\n<li><strong>Regex</strong>: <code>\\+\\s*['\"].*\\\\n</code></li>\n</ul>\n<h3>Line Length</h3>\n<ul>\n<li>Rely on the <code>lines_longer_than_80_chars</code> lint from the analyzer.</li>\n</ul>\n<h2>Related Skills</h2>\n<ul>\n<li><strong><a href=\"https://github.com/kevmoo/dash_skills/blob/main/skills/dart-modern-features/SKILL.md\">dart-modern-features</a></strong>: For idiomatic usage of modern Dart features like\nPattern Matching (useful for deep JSON extraction), Records, and Switch\nExpressions.</li>\n</ul>\n","files":[{"path":"evals/evals.json","sizeBytes":2197,"isText":true},{"path":"SKILL.md","sizeBytes":2835,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"notes-only","suspicious":0,"notes":8,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-09-14T18:30:28.370711Z","sha256":"71D6E20B8B086D654958836B2023C8CDAFCFFE75A91E9BD498DAEFA34139E19B","sizeBytes":2418},"review":null,"source":{"repositoryUrl":"https://github.com/kevmoo/dash_skills","path":"skills/dart-best-practices","license":"Apache-2.0","commit":"0b6371c26516df82443ee5491771befa70d60f0f","subtreeSha":"349F317D854CB595A96506D2DF8CDD3D0E617007E0410FF3E76715342ED1EEF9","lastSyncedAt":"2026-09-26T23:12:20.969684Z"},"reviewedAt":"2026-09-14T18:30:32.520012Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/kevmoo/dash_skills/tree/main/skills/dart-best-practices"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install kevmoo-dash-skills@llmmart"},{"target":"git","command":"git clone https://github.com/kevmoo/dash_skills.git"}]}