

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
1234567# Dart/Flutter Coding Style89> This file extends [common/coding-style.md](../common/coding-style.md) with Dart and Flutter-specific content.1011## Formatting1213- **dart format** for all `.dart` files — enforced in CI (`dart format --set-exit-if-changed .`)14- Line length: 80 characters (dart format default)15- Trailing commas on multi-line argument/parameter lists to improve diffs and formatting1617## Immutability1819- Prefer `final` for local variables and `const` for compile-time constants20- Use `const` constructors wherever all fields are `final`21- Return unmodifiable collections from public APIs (`List.unmodifiable`, `Map.unmodifiable`)22- Use `copyWith()` for state mutations in immutable state classes2324```dart25// BAD26var count = 0;27List<String> items = ['a', 'b'];2829// GOOD30final count = 0;31const items = ['a', 'b'];32```3334## Naming3536Follow Dart conventions:37- `camelCase` for variables, parameters, and named constructors38- `PascalCase` for classes, enums, typedefs, and extensions39- `snake_case` for file names and library names40- `SCREAMING_SNAKE_CASE` for constants declared with `const` at top level41- Prefix private members with `_`42- Extension names describe the type they extend: `StringExtensions`, not `MyHelpers`4344## Null Safety4546- Avoid `!` (bang operator) — prefer `?.`, `??`, `if (x != null)`, or Dart 3 pattern matching; reserve `!` only where a null value is a programming error and crashing is the right behaviour47- Avoid `late` unless initialization is guaranteed before first use (prefer nullable or constructor init)48- Use `required` for constructor parameters that must always be provided4950```dart51// BAD — crashes at runtime if user is null52final name = user!.name;5354// GOOD — null-aware operators55final name = user?.name ?? 'Unknown';5657// GOOD — Dart 3 pattern matching (exhaustive, compiler-checked)58final name = switch (user) {59 User(:final name) => name,60 null => 'Unknown',61};6263// GOOD — early-return null guard64String getUserName(User? user) {65 if (user == null) return 'Unknown';66 return user.name; // promoted to non-null after the guard67}68```6970## Sealed Types and Pattern Matching (Dart 3+)7172Use sealed classes to model closed state hierarchies:7374```dart75sealed class AsyncState<T> {76 const AsyncState();77}7879final class Loading<T> extends AsyncState<T> {80 const Loading();81}8283final class Success<T> extends AsyncState<T> {84 const Success(this.data);85 final T data;86}8788final class Failure<T> extends AsyncState<T> {89 const Failure(this.error);90 final Object error;91}92```9394Always use exhaustive `switch` with sealed types — no default/wildcard:9596```dart97// BAD98if (state is Loading) { ... }99100// GOOD101return switch (state) {102 Loading() => const CircularProgressIndicator(),103 Success(:final data) => DataWidget(data),104 Failure(:final error) => ErrorWidget(error.toString()),105};106```107108## Error Handling109110- Specify exception types in `on` clauses — never use bare `catch (e)`111- Never catch `Error` subtypes — they indicate programming bugs112- Use `Result`-style types or sealed classes for recoverable errors113- Avoid using exceptions for control flow114115```dart116// BAD117try {118 await fetchUser();119} catch (e) {120 log(e.toString());121}122123// GOOD124try {125 await fetchUser();126} on NetworkException catch (e) {127 log('Network error: ${e.message}');128} on NotFoundException {129 handleNotFound();130}131```132133## Async / Futures134135- Always `await` Futures or explicitly call `unawaited()` to signal intentional fire-and-forget136- Never mark a function `async` if it never `await`s anything137- Use `Future.wait` / `Future.any` for concurrent operations138- Check `context.mounted` before using `BuildContext` after any `await` (Flutter 3.7+)139140```dart141// BAD — ignoring Future142fetchData(); // fire-and-forget without marking intent143144// GOOD145unawaited(fetchData()); // explicit fire-and-forget146await fetchData(); // or properly awaited147```148149## Imports150151- Use `package:` imports throughout — never relative imports (`../`) for cross-feature or cross-layer code152- Order: `dart:` → external `package:` → internal `package:` (same package)153- No unused imports — `dart analyze` enforces this with `unused_import`154155## Code Generation156157- Generated files (`.g.dart`, `.freezed.dart`, `.gr.dart`) must be committed or gitignored consistently — pick one strategy per project158- Never manually edit generated files159- Keep generator annotations (`@JsonSerializable`, `@freezed`, `@riverpod`, etc.) on the canonical source file only160
One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| ThanhTrunggDEV/DontBeLazy.cursor/rules/zh-agents.mdc · 6 | Cursor rules | no sections | 50/100 | 14 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/rules/zh-patterns.mdc · 6 | Cursor rules | api | 30/100 | 14 days ago | |
| ThanhTrunggDEV/DontBeLazy.agent/AGENTS.md · 6 | AGENTS.md | buildteststylearch+4 | 77/100 | 14 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/AGENTS.md · 6 | AGENTS.md | buildteststylearch+4 | 77/100 | 14 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/rules/common-agents.mdc · 6 | Cursor rules | agent-behaviour | 50/100 | 14 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/rules/common-code-review.mdc · 6 | Cursor rules | styletesting-strategygitsecurity+3 | 65/100 | 14 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/rules/common-coding-style.mdc · 6 | Cursor rules | style | 54/100 | 14 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/rules/common-development-workflow.mdc · 6 | Cursor rules | gitagent-behaviour | 39/100 | 14 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/rules/common-git-workflow.mdc · 6 | Cursor rules | lint-formatgitagent-behaviour | 43/100 | 14 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/rules/common-hooks.mdc · 6 | Cursor rules | styletypessecuritydo-not | 36/100 | 14 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/rules/common-patterns.mdc · 6 | Cursor rules | lint-formatstyleapi | 52/100 | 14 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/rules/common-performance.mdc · 6 | Cursor rules | buildperformance | 48/100 | 14 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/rules/common-security.mdc · 6 | Cursor rules | security | 39/100 | 14 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/rules/common-testing.mdc · 6 | Cursor rules | testtesting-strategyagent-behaviour | 34/100 | 14 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/rules/cpp-coding-style.mdc · 6 | Cursor rules | lint-formatstyle | 52/100 | 14 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/rules/cpp-hooks.mdc · 6 | Cursor rules | buildlint-formatdeployment | 60/100 | 14 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/rules/cpp-patterns.mdc · 6 | Cursor rules | style | 54/100 | 14 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/rules/cpp-security.mdc · 6 | Cursor rules | securityperformancedo-not | 73/100 | 14 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/rules/cpp-testing.mdc · 6 | Cursor rules | testtesting-strategy | 55/100 | 14 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/rules/csharp-coding-style.mdc · 6 | Cursor rules | lint-formatstyletypes | 66/100 | 14 days ago |
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126 | Cursor rules | setupbuildtestlint-format+6 | 100/100 | 14 days ago | |
| TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 46 | Cursor rules | testlint-formatstylearch+5 | 100/100 | 14 days ago | |
| Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 14 days ago | |
| dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 14 days ago | |
| deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 14 days ago | |
| markstev/mark-starter.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+6 | 99/100 | 14 days ago | |
| langflow-ai/langflow.cursor/rules/docs_development.mdc · 153k | Cursor rules | setupbuildtestlint-format+7 | 97/100 | 14 days ago | |
| bybren-llc/safe-agentic-workflow.cursor/rules/10-backend-python.mdc · 399 | Cursor rules | testlint-formatstylegit+4 | 97/100 | today |
A badge carrying the measured quality of the strongest agent config file in this repository, out of 100. It reads from this index every time somebody loads your page, so it changes when the measurement changes and there is nothing to keep up to date. Free, no account, and the value is not something you or we can set by hand.
[](https://rulestack.kynth.studio/configs/thanhtrunggdev-dontbelazy-cursor-rules-dart-coding-style)Would rather not hotlink us? Every badge is also served in shields.io’s endpoint schema, so shields renders the image and your readers never talk to our domain:
Published by Toolproof, the masthead over this index and eight others. The method behind the number is at toolproof.kynth.studio/methodology, and the whole thing is readable as JSON with no key at /api.