Skip to content
pubscout

protoc_plugin

25.1.0, released 2 months ago by google.dev

Generates Dart source files from Protocol Buffer (.proto) definitions using the protoc compiler.

$ flutter pub add protoc_plugin
Source repository

What it does

The package provides a protoc plugin that reads .proto files and emits Dart code compatible with the protobuf runtime. It supports options for gRPC stubs and metadata generation.

AI-written summary of version 25.1.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need strongly‑typed Dart models from .proto schemas
  • You are building gRPC services or clients in Dart
  • You want a reproducible build step for protobuf files

Skip it when

  • You only need JSON serialization without protobuf
  • You cannot install the protoc compiler on the target platform

Strengths

  • Produces clean, formatted Dart code
  • Integrates with standard protobuf workflow
  • Supports gRPC and Kythe metadata options

Weaknesses

  • Requires external protoc installation
  • Only works with protobuf package versions

Setup

Kind
Pure Dart
Effort
Medium
Code generation
No
Direct dependencies
6

Install protoc (>=3.0.0), then run `dart pub global activate protoc_plugin` and ensure `~/.pub-cache/bin` is in PATH.

// After installing protoc and protoc_plugin
// Generate Dart code from a .proto file
// $ protoc --dart_out=. my_message.proto

Alternatives

Packages that do the same job and could replace protoc_plugin.

Works with

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