Skip to content
pubscout

proto_annotations

7.1.0, released 3 months ago by squarealfa.com

Annotations to mark and configure business model classes for code generation of .proto and Dart mappers.

$ flutter pub add proto_annotations
Source repository

What it does

Provides annotations that mark business model classes for code generation. Works with the proto_generator package to generate .proto files and Dart mapper classes.

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

Use it when

  • You are using Protocol Buffers in your Dart application and need to map them to business model classes.
  • You want automated code generation for .proto files from existing classes.

Skip it when

  • You are not using Protocol Buffers or gRPC in your application.
  • You prefer writing .proto files and mapping code manually.

Strengths

  • Automates the generation of .proto files and Dart mapper classes.
  • Supports well-known types, polymorphism, and configuration options via annotations.

Weaknesses

  • Requires a separate generator package to perform the actual code generation.
  • Adds external dependencies like grpc and protobuf to your project.

Setup

Kind
Pure Dart
Effort
Low
Code generation
Yes (build_runner)
Direct dependencies
6

Add the package to your dependencies alongside a code generator.

import 'package:proto_annotations/proto_annotations.py';

// Use annotations on your models

Alternatives

Packages that do the same job and could replace proto_annotations.

Works with

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