pigeon_generator
4.0.0, released 11 days ago by melvinotieno.com
Automates pigeon code generation via build_runner for platform channels
What it does
pigeon_generator integrates build_runner with pigeon, automatically generating Dart, Swift, Kotlin, Objective‑C, C++ and GObject code from pigeon files. It removes the need to run pigeon manually and supports multiple output paths and lint suppression.
AI-written summary of version 4.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to generate platform channel code for Flutter plugins or apps
- You want to avoid manual pigeon command execution
- You need multi‑platform code generation (iOS, Android, macOS, Windows, Linux)
- You prefer a single build_runner command to produce all outputs
Skip it when
- You only need a single platform (e.g., only Dart) and prefer minimal dependencies
- You are on an older Dart SDK that does not support the required minimum 3.11
- You already have a custom build script that handles pigeon generation
Strengths
- Fully automated build_runner integration
- Supports all pigeon output languages and multiple Swift paths
- Provides lint suppression and copyright header options
- Handles Windows path separators correctly
Weaknesses
- Requires Dart 3.11+ and pigeon 29.1.1+
- Adds build_runner as a dev dependency
- Configuration can be verbose for complex projects
- No runtime API, only build‑time generation
Setup
- Kind
- Pure Dart
- Effort
- Medium
- Code generation
- Yes (build_runner)
- Direct dependencies
- 6
Add build_runner, pigeon, and pigeon_generator to dev_dependencies, create a pigeons folder, configure build.yaml with inputs and optional outputs, then run `flutter pub run build_runner build`
```yaml
# pubspec.yaml
dev_dependencies:
build_runner: ^2.4.0
pigeon: ^29.1.1
pigeon_generator: ^4.0.0
# build.yaml
targets:
$default:
builders:
pigeon_generator:
options:
inputs: pigeons
```Alternatives
Packages that do the same job and could replace pigeon_generator.
- code_builder
A fluent, builder-based library for generating valid Dart code programmatically.
93Compare - copy_with_extension
Annotation for generating copyWith extensions code using copy_with_extension_gen.
87Compare - widgetbook_generator
Generates and sets up Widgetbook code via build_runner
81Compare - masamune
A Flutter framework that uses code generation to scaffold apps with built‑in state, routing, forms and theming.
77Compare
Works with
Packages commonly used together with pigeon_generator: ones it builds on, ones built on it, and its own family.
- yamlpigeon_generator depends on itA Dart library for parsing YAML documents into Dart data structures.
- buildpigeon_generator depends on itPackage for authoring build_runner compatible code generators.
- pigeonpigeon_generator depends on itType-safe code generator for communication between Flutter and host platforms.
- scratch_spacepigeon_generator depends on itManages running external executables within package:build via a temporary directory wrapper.
- build_runnerUsed togetherA build system for Dart code generation and modular compilation.