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.
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 modelsAlternatives
Packages that do the same job and could replace proto_annotations.
- freezed
Code generation for immutable classes, tagged unions, and cloning without boilerplate.
96Compare - copy_with_extension
Annotation for generating copyWith extensions code using copy_with_extension_gen.
87Compare - copy_with_extension_gen
Generate type‑safe copyWith extensions for annotated classes and record typedefs.
85Compare - source_gen
Source code generation builders and utilities for the Dart build system.
84Compare
Works with
Packages commonly used together with proto_annotations: ones it builds on, ones built on it, and its own family.
- json_annotationproto_annotations depends on itProvides annotations for json_serializable to generate JSON (de)serialization code.
- fixnumproto_annotations depends on itProvides 32‑ and 64‑bit signed fixed‑width integer types for Dart.
- protobufproto_annotations depends on itProvides runtime support for Dart protocol buffer messages generated by protoc_plugin.
- decimalproto_annotations depends on itArbitrary-precision decimal arithmetic for Dart
- rationalproto_annotations depends on itAllows you to deal with rational numbers in Dart.
- grpcproto_annotations depends on itDart implementation of gRPC, a high performance universal RPC framework.
- proto_generatorBuilt on proto_annotationsCode generation of .proto and Dart mapper classes for using PODOs with gRPC.