Search packages, repositories and app categories

Package detailsv3.1.0

freezed_annotation

Annotations for the freezed code-generator. This package does nothing without freezed too.

AndroidiOSWebmacOSWindowsLinux
30-day downloads
4.7M
Likes
564
Pub points
150

Install package

flutter pub add freezed_annotation

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

freezed_annotation provides annotations for the freezed code generator, enabling concise and type-safe Dart classes with built-in support for immutability, copyWith methods, and JSON serialization. It works in conjunction with the freezed package to generate boilerplate code automatically. This package is essential for developers seeking clean, maintainable data models without writing repetitive code. It supports modern Dart practices such as sealed classes and union types. The annotations are used during code generation and have no runtime impact on their own.

Use cases

  • Generating immutable data classes
  • Creating sealed classes for state management
  • Automating JSON serialization
  • Simplifying state representation in UI
  • Enabling copyWith functionality
  • Defining union types

Key features

  • Immutability by default
  • Automatic copyWith methods
  • JSON serialization support
  • Sealed class generation
  • Union type definitions
  • Minimal boilerplate

Suitable for

  • Dart developers using freezed
  • Projects requiring immutable data models
  • State management with clean state classes
  • JSON-heavy applications
  • Teams prioritizing code maintainability
  • Apps targeting multiple platforms

Considerations

  • Requires the freezed package to function
  • Code generation must be enabled
  • Not suitable for runtime reflection
  • Limited to compile-time code generation
  • Dependencies must be managed carefully
  • No standalone runtime behavior

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

packages/freezed/README.md

Categories

Dependencies

Dependency list 3 items

Source repository

Projects using this package