NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
pub.dev · #236 most downloaded on pub.dev
Code generation for immutable classes that has a simple syntax/API without compromising on the features.
Last release 10 days ago
18 Sep 2026
Ships fairly regularly
a new release about every 2 months
Nearly every release is documented
notes for 60 of the last 60 stable releases
1 version withdrawn
withdrawn after publishing
7 years old
146 releases · first in 2020
One column per quarter.
Updated the README
Updated the README
Fixed a regression with the ==/hashCode implementation generated for classes with custom implementations of List/Map/... (see https://github.com/rrous
Fixed a regression with the ==/hashCode implementation generated for
classes with custom implementations of List/Map/... (see https://github.com/rrousselGit/freezed/issues/561)
Fixed an issue where some build.yaml options were not properly considered. This includes changing where the generated files should be placed. (Thanks
Fixed an issue where some build.yaml options were not properly considered.
This includes changing where the generated files should be placed. (Thanks to @sperochon)
reverted an involuntary change of how union types were de/serialized, breaking existing code.
Freezed is now stable
This release also:
Fixed a bug where the generated code for serializable unions with a base class was invalid
The union key is no longer passed json_serializable when deserializing avoid the case of being an unrecognized_key in some cases.
json_serializable when deserializing avoid the case of being an unrecognized_key in some cases.toJson function, it will now always take precedence over
the default implementation generated by Freezed.Fixed the generated hashCode not compiling for objects with a large number of properties.
Fixed the generated hashCode not compiling for objects with a large number
of properties. (#531)
Breaking Changed the syntax for @With and @Implements to use a generic annotation. Before:
Breaking Changed the syntax for @With and @Implements to use a generic annotation.
Before:
@With(MyClass)
@With.fromString('Generic<int>')
After:
@With<MyClass>()
@With<Generic<int>>()
Fixed an issue with fromJson tear-offs not allowing Object? as map value. (#520)
Optimized the generated implementation of hashCode and ==
Fixed an issue when MyClass<Object>() and MyClass<int>() could be considered equal
Require Dart SDK >=2.14.0.
fixed a bug when using alias imports, potentially using the prefix on every variables.
@Freezed(fallback: '...') is specified and using fromJson, now
support cases where the JSON does not contain the "key".Now supports types coming from import '...' as alias;
import '...' as alias;toString is overridden, Freezed no-longer applies Diagnosticable which would break the toString (fixes #221)union.whenOrNull and union.mapOrNull, similar to maybeWhen and maybeMap
but instead of an orElse they return null.Upgraded to support json_serializable 5.0.0
fromJson now throws CheckedFromJsonException if it fails to deserialize an object.Added the ability to specify a fallback constructor when deserializing unions (thanks to @Brazol)
Fixed issues with recursive Freezed classes that could cause the parameter type to be inferred as dynamic (see #399)
dynamic (see #399)build and other similar dependencies to latestFixed examples in the README
Fixed examples in the README
Upgrade dependencies
Upgrade dependencies
Added the ability to customize the JSON value of a union. See https://github.com/rrousselGit/freezed#fromjson---classes-with-multiple-constructors for
Added the ability to customize the JSON value of a union. See https://github.com/rrousselGit/freezed#fromjson---classes-with-multiple-constructors for more information (Thanks to @ookami-kb)
Fix an issue where Freezed would not generate code properly if freezed_annotation
was indirectly imported (by importing a library that exports freezed_annotation) (Thanks to @ookami-kb)
fix sort_unnamed_constructors_first and cast_nullable_to_non_nullable in the generated code (Thanks to @gaetschwartz #372)
sort_unnamed_constructors_first and cast_nullable_to_non_nullable in the generated code (Thanks to @gaetschwartz #372)Fixed an issue where a factory using the => syntax (so not managed by Freezed) with default values could break code-generation.
@Assert no-longer workingfactory using the => syntax (so not managed by Freezed)
with default values could break code-generation.Upgraded analyzer to support latest versions
Stable null-safety release
Upgraded analyzer to support latest versions
Freezed classes no-longer need to be abstract.
Before:
@freezed
abstract class Example with _$Example {
factory Example(int value) = _Example;
}
after:
@freezed
class Example with _$Example {
factory Example(int value) = _Example;
}
This leads to better error messages when a Freezed class uses interfaces/mixins but the class is missing a specific property.
It is now allowed to add unimplemented getter to Freezed classes. This can be useful to guarantee that union-types all have a common property:
@freezed
class Union with _$Union {
const factory Union.left(int value) = _Left;
const factory Union.right(int value) = _Left;
@override
int get value; // adding this forces all union cases to possess a `value` property
}
Excluded getters and late variables from the generated toString as they could potentially cause a StackOverflow
Fixed a bug causing properties with annotations to generate the annotations before the `required keyword, leading to a compilation error (see #351).
Upgraded analyzer to support latest versions
analyzer to support latest versionsFreezed classes no-longer need to be abstract. Before:
Freezed classes no-longer need to be abstract.
Before:
@freezed
abstract class Example with _$Example {
factory Example(int value) = _Example;
}
after:
@freezed
class Example with _$Example {
factory Example(int value) = _Example;
}
This leads to better error messages when a Freezed class uses interfaces/mixins but the class is missing a specific property.
It is now allowed to add unimplemented getter to Freezed classes. This can be useful to guarantee that union-types all have a common property:
@freezed
class Union with _$Union {
const factory Union.left(int value) = _Left;
const factory Union.right(int value) = _Left;
@override
int get value; // adding this forces all union cases to possess a `value` property
}
Excluded getters and late variables from the generated toString as they could potentially cause a StackOverflow
toString as they could potentially cause a StackOverflowFixed a bug causing properties with annotations to generate the annotations _before_ the `required keyword, leading to a compilation error (see #351).
Migrated to null safety
Migrated to null safety
fixed a bug where /// above a constructor could cause the generation to stop working (see also https://github.com/rrousselGit/freezed/issues/326)
/// above a constructor could cause the generation to stop working (see also https://github.com/rrousselGit/freezed/issues/326)Fix Freezed generating code from constructors that do not rely on Freezed
Fixes a bug where comments on named parameters could break generation
fixed a bug that caused the code-generation to never complete
Renamed Result in generated code to TResult to avoid naming conflicts
Result in generated code to TResult to avoid naming conflictsInconsistentAnalysisException sometimes being thrown (https://github.com/rrousselGit/freezed/issues/294)Renamed Result in generated code to TResult to avoid naming conflicts
Result in generated code to TResult to avoid naming conflictsInconsistentAnalysisException sometimes being thrown (https://github.com/rrousselGit/freezed/issues/294)Upgrade the dependencies (analyzer, build_runner)
fromJson constructor still generated the fromJson
constructor with json_serializable
(see also https://github.com/rrousselGit/freezed/issues/280)unionKey contains special characters
(see also https://github.com/rrousselGit/freezed/issues/274)Removed dependency on _fe_analyzer_shared
_fe_analyzer_sharedAdded /// @nodoc on objects generated by Freezed that starts with $ to not pollute dartdoc.
Added /// @nodoc on objects generated by Freezed that starts with $
to not pollute dartdoc.
Added support for documenting properties, by documenting the constructor parameters:
@freezed
abstract class Example with _$Example {
const factory Example(
/// Some documentation
String parameter,
) = Person;
}
Added Assert decorator to generate assert(...) statements on Freezed classes:
@freezed
abstract class Person with _$Person {
@Assert('name.trim().isNotEmpty', 'name cannot be empty')
@Assert('age >= 0')
factory Person({
String name,
int age,
}) = _Person;
}
Now generates a constructor tear-off for fromJson too:
@freezed
abstract class Person with _$Person {
factory Person({ String name, int age}) = _Person;
factory Person.fromJson(Map<String, dynamic> json) => _$PersonFromJson(json);
}
List<Map<String, dynamic>> list;
List<MyClass> persons = list.map($Person.fromJson).toList();
Added a way to customize the de/serialization of union types using the
@Freezed(unionKey: 'my-key') decorator.
See also https://github.com/rrousselGit/freezed#fromjson---classes-with-multiple-constructors
Fixed a bug where deep-copy did not work properly for recursive classes
Fixed a bug where deep-copy did not work properly for recursive classes (https://github.com/rrousselGit/freezed/issues/213)
Fixed a situation where @late properties could trigger a RangeError (https://github.com/rrousselGit/freezed/issues/219)
Fixed a bug in which case Freezed generated an invalid copyWith implementation
copyWith implementationNo-longer generate when/... for private constructors.
when/... for private constructors.Fixed a bug where the generated class incorrectly used Diagnosticable event if package:flutter/foundation wasn't imported. (Thanks to @avbk)
Diagnosticable event if package:flutter/foundation wasn't imported. (Thanks to @avbk)Generate when/map/... even for classes with a single constructors (thanks @andrzejchm)
when/map/... even for classes with a single constructors (thanks @andrzejchm)Further improve the parsing of recursive freezed class to avoid dynamics
dynamicsAdded @With and @Implements decorators to allow only a specific constructor of a union type to implement an interface:
Added @With and @Implements decorators to allow only a specific constructor
of a union type to implement an interface:
@freezed
abstract class Example with _$Example {
const factory Example.person(String name, int age) = Person;
@Implements(GeographicArea)
const factory Example.city(String name, int population) = City;
}
Thanks to @long1eu
Fixed a bug where a recursive freezed class may generate a property as dynamic (thanks to @maks)
Improved the readme (Thanks to @scopendo and @Matsue)
Nothing published for this version
Fixes a bug where code-generation could end-up in a Stack Overflow if a class depends on itself
Fix code-generation issue for deep-copy of generic objects
Fixes a bug where classes with both getters and consts constructors caused an exception.
do not create @required annotation for positional arguments on when/map functions (thanks to @hpoul)
@required annotation for positional arguments on when/map functions (thanks to @hpoul)Fixes classes with getters and a private MyClass._() constructor not properly generating.
Fixes classes with getters and a private MyClass._() constructor not properly generating.
Fixed Freezed trying to generate code for factory constructors with a complex body.
Fixed Freezed trying to generate code for factory constructors with a complex body.
Fixes Freezed trying to generate code for files that don't use it
Fixes a bug where deep copy did not compile if the class definitions were spread on multiple files.
Fixed a stack-overflow during generation on recursive classes
Consider optional parameters with a default value as non-nullable
toString if the user-defined class already overrides toStringNothing published for this version
Nothing published for this version
Fixes parsing of recursive classes
Fixes parsing of recursive classes
Support enum and static const default values
Support enum and static const default values
Support class-level decorators (see https://github.com/rrousselGit/freezed/issues/50)
Support class-level decorators (see https://github.com/rrousselGit/freezed/issues/50)
Generated file now ignores invalid_override_different_default_values_named
Generated file now ignores invalid_override_different_default_values_named
Nothing published for this version
Now also generate constructor tear-off.
Now also generate constructor tear-off.
Fixes @Default generating invalid code if the default value explicitly used const.
Fixes @Default generating invalid code if the default value explicitly used const.
Your coding agent can read these notes before it upgrades. Set up the MCP server →