🎯 Dart — Engineering Reference
A code-first, production-grade Dart engineering reference. Each chapter is a deep-dive with annotated code blocks covering complex implementations, anti-patterns, edge cases, and performance optimizations. Designed for mid-level developers transitioning to senior roles who learn best through rigorous, real-world code.
How to Use This Reference
- Read sequentially for a complete engineering tour (01 → 19).
- Jump to a chapter as a reference when you hit a concept in production.
- Run the examples —
dart runis your REPL, DartPad for quick experiments. - Focus on the anti-pattern sections — each shows the naive code, the trap, and the production fix.
Prerequisites
- The Dart SDK installed (
brew install dartor see chapter 01). - A code editor (VS Code with the Dart extension recommended).
- Solid programming fundamentals (this is not a beginner tutorial).
Curriculum
Part I — Language Architecture
| # | Topic | Why It Matters |
|---|---|---|
| 01 | Architecture, Compilation & Toolchain | AOT/JIT/kernel pipeline, platform conditionals, pubspec.yaml, native compilation. |
| 02 | Variables, Type System & Memory | const canonicalization, late lazy init, platform-dependent int, records. |
| 03 | Operators, Promotion & Expressions | Null-aware chains, type promotion rules, cascade mechanics, overflow. |
| 04 | Control Flow, Exhaustiveness & Patterns | Dart 3 exhaustive switches, sealed patterns, record destructuring, guards. |
| 05 | Functions, Closures & Generators | Parameter semantics, closure capture, sync*/async*, callable classes. |
Part II — Core Systems
| # | Topic | Why It Matters |
|---|---|---|
| 06 | Collections, Iterables & Allocation | Lazy chain evaluation, spread/collection-if, immutable views vs copies. |
| 07 | Classes, Sealed Hierarchies & Mixins | Const canonicalization, sealed exhaustiveness, mixin linearization, factories. |
| 08 | Sound Null Safety & Flow Analysis | Promotion rules (fields/closures/await), late semantics, nullable algebra. |
| 09 | Async Internals, Futures & Streams | Event loop, Future.wait composition, stream backpressure, zones. |
| 10 | Isolates, Actor Model & Zero-Copy | Isolate.run, worker pools, TransferableTypedData, when to use isolates. |
Part III — Advanced Semantics
| # | Topic | Why It Matters |
|---|---|---|
| 11 | Exceptions, Errors & Async Propagation | Exception vs Error, rethrow stack preservation, runZonedGuarded, swallow traps. |
| 12 | Reified Generics, Bounds & Covariance | Runtime type info, bounded params, covariance soundness, is T vs as T. |
| 13 | Libraries, Visibility & Packages | Library-private _, conditional imports, barrel files, deferred loading. |
| 14 | Testing, Mocking & Async Patterns | Matcher composition, async test semantics, mocktail, parameterized tests. |
| 15 | Web Compilation, JS Interop & Cross-Platform | dart2js/DDC/Wasm, extension types, conditional imports, web limitations. |
Part IV — Application & Production
| # | Topic | Why It Matters |
|---|---|---|
| 16 | Flutter Widget Architecture & Lifecycle | const canonicalization, build purity, mounted after await, state management. |
| 17 | Server Architecture, Middleware & Database | shelf pipelines, dart_frog routing, streaming I/O, parameterized SQL, AOT deploy. |
| 18 | Tooling, Code Generation & CI/CD | Strict analysis, build_runner, freezed/json_serializable, CI pipeline. |
| 19 | Production Projects & Capstone | CLI parser, stream pipeline, isolate image processor, full-stack capstone. |
Learning Path Suggestions
If you're coming from JavaScript/TypeScript
Read 02–03 (type system is stricter, const/final/late differ). Read 08 (sound null safety — promotion rules differ from TS). Read 09 (async — Future/Stream like Promise/AsyncIterator but with backpressure). Read 07 (sealed classes, mixins). Read 16 (Flutter) if doing UI.
If you're coming from Java/C#/Kotlin
Read 02–03 (syntax is familiar, but var/final/const/null-safety differ). Read 05 (named params, required). Read 07 (sealed classes, mixins — Dart 3). Read 08 (null safety — ?/!/promotion). Read 12 (reified generics — unlike Java's erasure). Read 09 (async — Future/Stream like CompletableFuture/Flow).
If you're learning Dart for Flutter
Read 01–09 (core language). Skim 10 (isolates — rare in Flutter). Read 16 (Flutter widget lifecycle, build purity, mounted) closely. Read 18 (build_runner, freezed). Read 15 (web) if targeting Flutter Web.
If you're a senior Dart/Flutter engineer
Focus on 03 (promotion across closures/await/fields), 07 (sealed exhaustiveness, mixin linearization), 08 (promotion pitfalls), 09 (Future.wait composition, stream backpressure, zones), 10 (TransferableTypedData, worker pools), 12 (covariance soundness, is T vs as T), 17 (shelf middleware, streaming I/O, dart compile exe), 19 (production patterns, capstone).
Companion Resources
- Dart.dev — official docs (language tour, library tour).
- DartPad — online editor, no install.
- pub.dev — package registry.
- Effective Dart — style and best practices.
- Flutter Docs — for Flutter (chapter 16).
- Dart API Reference — core libraries.
Tooling
# Install the Dart SDK (macOS):
brew tap dart-lang/dart
brew install dart
# Verify:
dart --version
# VS Code with the Dart extension (Dart-Code.dart-code):
# - Code completion, refactoring, debugging
# - Hot reload (Flutter)
# - dart format on save
# - dart analyze diagnostics