NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
pub.dev · #174 most downloaded on pub.dev
Annotations for the freezed code-generator. This package does nothing without freezed too.
Last release 1 years ago
02 Jul 2025
Release timing varies
gaps range from 2 weeks to 12 months
Nearly every release is documented
notes for 25 of 26 stable releases
1 version withdrawn
withdrawn after publishing
7 years old
29 releases · first in 2020
One column per quarter.
Added when/map back
Added when/map back
Breaking removed when/map related options
when/map related options- Require json_annotation ^4.8.0
Stop using JsonKey(ignore: true) in favour of JsonKey(includeFromJson: false, includeToJson: false) (thanks to @lrsvmb)
JsonKey(ignore: true) in favour of JsonKey(includeFromJson: false, includeToJson: false)
(thanks to @lrsvmb)- Require Dart >=3.0.0 - Support latest collection
collectionThe generic type of @With/@Implements now defaults to Object? instead of dynamic
@With/@Implements now defaults to Object? instead of dynamicwhen/map variants at once (thanks to @gaetschwartz)Re-introduced @With.fromString and @Implements.fromString to allow unions to implement generic types. (thanks to @rorystephenson)
@With.fromString and @Implements.fromString to allow unions
to implement generic types. (thanks to @rorystephenson)Add support for de/serializing generic Freezed classes (Thanks to @TimWhiting)
– fix: build.yaml decoding crash
– fix: build.yaml decoding crash
Fixed a bug where the generated when/map methods were potentially invalid when using default values
Breaking: freezed_annotation no-longer exports the entire package:collection
Breaking: freezed_annotation no-longer exports the entire package:collection
Breaking Removed @Freezed(maybeMap: ) & @Freezed(maybeWhen: ) in favor of a separate:
@Freezed(map: FreezedMap(...), when: FreezedWhenOptions(...))
Feat: Add screaming snake union case type (#617) (thanks to @zbarbuto)
Added @unfreezed as a variant to @freezed, for mutable classes
Added support for disabling the generation of maybeMap/maybeWhen (thanks to @Lyokone)
Added support for disabling the generation of maybeMap/maybeWhen (thanks to @Lyokone)
freezed_annotation is now stable
freezed_annotation is now stable
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>>()
Upgraded to support last json_annotation version
Upgraded to support last json_annotation version
Added the ability to specify a fallback constructor when deserializing unions (thanks to @Brazol)
Added the ability to customise the JSON value of a union. See https://github.com/rrousselGit/freezed#fromjson---classes-with-multiple-constructors for
removed @nullable. Instead of: `dart factory Example({@nullable int a}) = _Example; Do: dart factory Example({int? a}) = _Example; `
Stable null safety release
removed @nullable.
Instead of:
factory Example({@nullable int a}) = _Example;
Do:
factory Example({int? a}) = _Example;
removed @late.
Instead of:
abstract class Person with _$Person {
factory Person({
required String firstName,
required String lastName,
}) = _Person;
@late
String get fullName => '$firstName $lastName';
}
Do:
abstract class Person with _$Person {
Person._();
factory Person({
required String firstName,
required String lastName,
}) = _Person;
late final fullName = '$firstName $lastName';
}
removed @nullable. Instead of: `dart factory Example({@nullable int a}) = _Example; Do: dart factory Example({int? a}) = _Example; `
Migrated to null safety
removed @nullable.
Instead of:
factory Example({@nullable int a}) = _Example;
Do:
factory Example({int? a}) = _Example;
removed @late.
Instead of:
abstract class Person with _$Person {
factory Person({
required String firstName,
required String lastName,
}) = _Person;
@late
String get fullName => '$firstName $lastName';
}
Do:
abstract class Person with _$Person {
Person._();
factory Person({
required String firstName,
required String lastName,
}) = _Person;
late final fullName = '$firstName $lastName';
}
Added Assert decorator to generate assert(...) statements on Freezed classes:
Added Assert decorator to generate assert(...) statements on Freezed classes:
abstract class Person with _$Person {
@Assert('name.trim().isNotEmpty', 'name cannot be empty')
@Assert('age >= 0')
factory Person({
String name,
int age,
}) = _Person;
}
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
Added @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~
Nothing published for this version
Nothing published for this version
Minor change to @Default to fix an issue with complex default values.
Minor change to @Default to fix an issue with complex default values.
Add @Default annotation
Add @Default annotation
Added @late annotation.
Added @late annotation.
Added a @nullable annotation.
Added a @nullable annotation.
Change version of collection to work with flutter_test.
Change version of collection to work with flutter_test.
Initial release of the annotation package.
Initial release of the annotation package.
Your coding agent can read these notes before it upgrades. Set up the MCP server →