FLUTTER ECOSYSTEM

freezed

Code generation for immutable classes that has a simple syntax/API without compromising on the features.

Latest version
4.0.2
30-day downloads
2.7M
Likes
4.5K
Pub points
160

Package Overview

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

Overview

Freezed is a Flutter/Dart package that simplifies the creation of immutable data classes through code generation. It offers a clean, intuitive syntax for defining classes with built-in support for equality, hashing, copying, and JSON serialization. By leveraging annotations, Freezed reduces boilerplate and enhances type safety, making it ideal for managing state in apps using patterns like Redux or Bloc. The generated code is efficient and fully compatible across platforms.

Use cases
  • State management in Flutter apps
  • Immutable data modeling
  • JSON serialization
  • Type-safe configuration objects
  • Reducing boilerplate in domain models
Key features
  • Automatic immutable class generation
  • Built-in equality and hash support
  • CopyWith method generation
  • JSON serialization via `fromJson`/`toJson`
  • Simple annotation-based API
Suitable for
  • Developers seeking clean state management
  • Teams prioritizing code maintainability
  • Projects requiring robust data models
  • Flutter apps using functional programming patterns
  • Apps needing efficient JSON handling
Considerations
  • Requires code generation (build_runner)
  • Learning curve for new users
  • Dependency on build_runner and associated tools
  • Limited runtime flexibility compared to mutable classes
  • Potential for larger build times with many classes
Supported platformsAndroidiOSmacOSWindowsLinux

Install package

flutter pub add freezed

Categories

Dependencies

Dependency list 11 items

Source repository

Related projects

Rankings