“code-generation”
Source Generation Patterns in Dart: Annotations, Builders, and When to Skip It
Patterns for build and source_gen: annotation-driven generators, consuming .g.dart files, isolating generated APIs, build.yaml tuning, and when to skip codegen.
Dart source_gen Utilities: Generators, LibraryReader, TypeChecker, and build_test
Write and ship a source generator: Generator and GeneratorForAnnotation, ConstantReader, TypeChecker, LibraryReader, buildStep output, build_runner, and tests.
Supercharging Build Runner: Performance Upgrades and Faster Code Generation in 2026
Discover the latest optimizations in Dart build_runner, incremental caching, and how they solve slow code generation in large Flutter projects.
Dart Macros: Compile-Time Code Generation Comes to the Language
Dart macros promised in-language compile-time code generation with deep semantic introspection. The program was paused in January 2025 over hygiene, analyzer integration, and compile-time performance. This post explains what macros were designed to do, why they did not ship, what the 2026 roadmap replaces them with, and how to keep using build_runner today.
Code Generation with build_runner in Dart and Flutter
A practical guide to build_runner: builders, annotations, watch mode, build.yaml configuration, and how to keep generated code fast and out of your way.
JSON Serialization in Flutter with json_serializable
json_serializable 6.14.1 generates type-safe to/from JSON code, enums, custom converters, and even JSON Schema — no hand-written maps.
Networking in Flutter: Dio Interceptors and Retrofit Code Generation
A production-oriented tour of Flutter HTTP clients: Dio's interceptors, transformers and adapters, plus Retrofit-generated type-safe REST clients on top of Dio.
Freezed for Flutter: Immutable Data Classes, Unions, and Deep CopyWithout the Boilerplate
A guide to Freezed v4 for Dart and Flutter: generated copyWith, equality, and toString; sealed union types with pattern matching; @Default, @Assert, JSON serialization, deep copies, and when to prefer it over hand-written classes.
Pigeon: Type-Safe Platform Channels Without the Boilerplate
How the Pigeon code generator replaces hand-written MethodChannel code with type-safe Dart-defined APIs for Kotlin, Swift, Objective-C, Java, C++, and Linux — with async calls, error handling, and when to prefer FFI.
Flutter L10n (Localization): The Complete Guide to Localizing Your App
Master Flutter localization (l10n) with flutter_localizations, code generation, and the official localization workflow for Android, iOS, and web.
Dart Augmentations: Simplifying Code Generation in 2026
Dart Augmentations are coming in 2026 to streamline code generation. Learn what augmentations are, how they replace build_runner patterns, and why they matter.
From Autocomplete to Agents: The Shift That Changes Everything
The AI that helps you write code has evolved. Understanding the fundamental difference between tools that suggest and tools that act.
From Idea to App: Using AI to Generate Flutter UI Code
Discover how to leverage AI tools to rapidly prototype and generate Flutter UI code from simple text descriptions or wireframes.