| Principle | Dart Implementation |
|---|---|
| Intent–Structure–Implementation Separation | TypeScript interfaces → Dart abstract interface class; data models → freezed; API contracts → OpenAPI |
| Generative Conformance | build_runner + source_gen + freezed + json_serializable |
| Skeleton–Tissue Architecture | base class for skeleton (manual) + concrete classes (generated) |
| Recursive Refinement with Fixed Premises | Git tags + pubspec.lock + Melos workspaces |
| Validation Gates | dart analyze + custom_lint + test_coverage + build_verify |
openapi_generator or openapi-generator (Dart client)specification/openapi/@freezed and @JsonSerializable()build_runner produces .g.dart filesjson_schema3 (Draft 7) for JSON Schema conformanceabstract interface class (pure interface) or base class (with partial implementation)custom_lint rules forbid invalid dependencieslib/
├── specification/ # OpenAPI, JSON Schema, custom annotations
├── skeleton/ # Base classes (manual, never regenerated)
│ └── game_loop.dart # base class with template method
├── tissue_src/ # Source files with generation annotations
│ └── models/
│ └── player.dart # @freezed, @JsonSerializable()
└── tissue/ # Generated code (.g.dart) - do not edit manually
base modifier to prevent external implementationfinal algorithm methods// skeleton/game_loop.dart
base class GameLoopSkeleton {
final void run() {
onInitialize();
while (isRunning) {
onUpdate(deltaTime);
onRender();
}
onDispose();
}
void onInitialize() {}
void onUpdate(double dt) {}
void onRender() {}
void onDispose() {}
}
build_runner// tissue_src/game_logic.dart
import 'package:my_app/skeleton/game_loop.dart';
part 'game_logic.g.dart';
@GenerateTissue() // custom annotation
class GameLogic extends GameLoopSkeleton {
@override
void onUpdate(double dt) {
// implementation generated or written
}
}
custom_lint rule: tissue → skeleton allowed; reverse forbiddendart run custom_lint fails on violationsbuild_runner orchestrates generationsource_gen provides AST-based generation APIfreezed + json_serializable produce immutable data classesbuild.yaml)targets:
$default:
builders:
source_gen|combining_builder:
generate_for:
- lib/tissue_src/**.dart
freezed|freezed:
generate_for:
- lib/tissue_src/models/**.dart
dart run build_runner build --delete-conflicting-outputs
| Gate | Tool | Command | Fail Condition |
|---|---|---|---|
| Format | dart format |
dart format --check . |
Unformatted code |
| Static analysis | dart analyze |
dart analyze --fatal-infos |
Any warning or info |
| Custom lint | custom_lint |
dart run custom_lint |
Dependency violation |
| Generation sync | build_verify |
dart run build_verify |
Outdated .g.dart files |
| Unit tests | dart test |
dart test --coverage |
Test failure |
| Coverage | test_coverage |
dart pub global run test_coverage --min-coverage 80 |
Below threshold |
analysis_options.yaml)include: package:lints/recommended.yaml
analyzer:
language:
strict-casts: true
strict-inference: true
strict-raw-types: true
linter:
rules:
- avoid_unused_constructor_parameters
- cancel_subscriptions
is, as, runtimeType for type testsdart:mirrors): replace with reflectable (code‑generated reflection)| Artifact | Purpose | Version Control |
|———-|———|—————-|
| pubspec.yaml | Dependency declarations | Always |
| pubspec.lock | Exact versions (applications only) | Yes for apps, no for libraries |
| analysis_options.yaml | Static analysis rules | Always |
| specification/ | OpenAPI, JSON Schema, interfaces | Always |
| .g.dart files | Generated code state | Always (with CI sync check) |
| Git tag | Phase boundary marker | phase/1, phase/2, … |
# Start from previous phase tag
git checkout phase/N-1
git checkout -b feature/phase-N
# 1. Update structural specification (OpenAPI, JSON Schema, interfaces)
# 2. Regenerate tissue
dart run build_runner build --delete-conflicting-outputs
# 3. Run validation gates
dart format --check .
dart analyze --fatal-infos
dart run custom_lint
dart run build_verify
dart test --coverage
# 4. Commit and tag
git add .
git commit -m "feat: Phase N implementation"
git tag phase/N
git push origin phase/N
git checkout phase/N-1
dart pub get
dart run build_runner build
my_project/
├── pubspec.yaml # workspace definition
├── packages/
│ ├── skeleton/ # base classes (manual)
│ ├── specification/ # OpenAPI, schemas
│ └── tissue/ # generated code (multiple packages)
└── apps/
├── mobile/ # Flutter app (with pubspec.lock)
└── web/ # web app
pubspec.yaml)name: my_project
workspace:
- packages/*
- apps/*
melos bootstrap # install dependencies across all packages
melos run test # run tests in all packages
melos version --yes # bump versions based on conventional commits
| Limitation | Workaround |
|---|---|
No reflection in Flutter (dart:mirrors) |
Use reflectable for code‑generated reflection; prefer compile‑time validation |
Generated code placement (.g.dart + part) |
Accept current pattern; future external part syntax will improve isolation |
| No built‑in Design by Contract | Enforce contracts via base classes, custom_lint, and runtime assertions |
| Flutter absolute path embedding | Not fully reproducible; accept functional reproducibility (same behavior, not bit‑identical) |
Library vs application pubspec.lock |
Only commit lock file for final applications, not for reusable tissue packages |
strict-* options in analysis_options.yamlskeleton/, tissue_src/, specification/build_runner, freezed, json_serializable to pubspec.yamlbase classes with final template methods@freezed and @JsonSerializable()custom_lint with dependency direction rulephase/1This implementation plan provides a complete, toolchain‑integrated pathway for applying specification‑driven development (Deep Coding) to Dart projects. Every principle translates to concrete Dart constructs:
abstract interface classbuild_runner + source_gen + freezedbase classes + generated .g.dart filesdart analyze, custom_lint, test_coverage, build_verifypubspec.lock + Git tagsThe plan is executable in production Dart and Flutter projects. No philosophical axioms are required; all mechanisms are native to the Dart ecosystem.