freezed_annotation
3.1.0, released a year ago by dash-overflow.net
Annotations for the freezed code-generator.
What it does
Provides annotations used by the freezed code-generator package to create immutable data classes and union types. This package does nothing without freezed.
AI-written summary of version 3.1.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You are using the freezed code-generator for immutable models
- You need annotations like @freezed, @unfreezed, @With, or @Implements
Skip it when
- You are not using code generation or freezed
- You need the full freezed generator functionality rather than just annotations
Strengths
- Lightweight package providing only the necessary annotations for freezed
- Clear separation between annotations and the code generation logic
Weaknesses
- Does nothing without the freezed package
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- Yes (build_runner)
- Direct dependencies
- 3
Add to dependencies alongside freezed and build_runner in dev_dependencies.
import 'package:freezed_annotation/freezed_annotation.dart';
part 'example.freezed.dart';
@freezed
class Example with _$Example {
const factory Example({required String name}) = _Example;
}Alternatives
Packages that do the same job and could replace freezed_annotation.
- built_value
Alternative approach to creating immutable value classes in Dart via code generation.
88Compare - json_serializable
Alternative code generator focused specifically on JSON serialization rather than full union types and immutability patterns.
94Compare
Works with
Packages commonly used together with freezed_annotation: ones it builds on, ones built on it, and its own family.
- json_annotationfreezed_annotation depends on itProvides annotations for json_serializable to generate JSON (de)serialization code.
- freezedBuilt on freezed_annotationCode generation for immutable classes, tagged unions, and cloning without boilerplate.
- custom_lintBuilt on freezed_annotationTool for creating and running custom Dart lint rules
- device_frameBuilt on freezed_annotationProvides mock device frames to preview Flutter UI on various device screens.
- flutter_stripe_webBuilt on freezed_annotationStripe SDK bindings for the Flutter web platform.
- stream_chatBuilt on freezed_annotationLow‑level Dart client for Stream Chat API
- stream_chat_flutter_coreBuilt on freezed_annotationCore Flutter SDK for Stream Chat providing business logic and controllers without UI.
- better_test_reporterBuilt on freezed_annotationCLI to convert Dart test JSON output to JUnit XML and provide models