Skip to content
pubscout

pigeon_generator

4.0.0, released 11 days ago by melvinotieno.com

Automates pigeon code generation via build_runner for platform channels

$ flutter pub add pigeon_generator
Source repository

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.

Works with

Packages commonly used together with pigeon_generator: ones it builds on, ones built on it, and its own family.