pub repository
mirror.p-hatan.comfreezed_annotation
3.1.0Annotations for the freezed code-generator. This package does nothing without freezed too.
Readme
Annotations for freezed.
This package does nothing without freezed.
Changelog
3.1.0 - 2025-07-02
Added when/map back
3.0.0 - 2025-02-25
- Breaking removed
when/maprelated options
2.4.4 - 2024-07-15
- Require json_annotation ^4.8.0
2.4.3 - 2024-07-09 (retracted)
- Stop using
JsonKey(ignore: true)in favour ofJsonKey(includeFromJson: false, includeToJson: false)(thanks to @lrsvmb)
2.4.2 - 2024-07-02
- Require Dart >=3.0.0
- Support latest
collection
2.4.1 - 2023-07-12
- The generic type of
@With/@Implementsnow defaults toObject?instead ofdynamic - Allow enabling/disabling all
when/mapvariants at once (thanks to @gaetschwartz)
2.2.0
- Re-introduced
@With.fromStringand@Implements.fromStringto allow unions to implement generic types. (thanks to @rorystephenson)
2.1.0
- Add support for de/serializing generic Freezed classes (Thanks to @TimWhiting)
2.0.3
โ fix: build.yaml decoding crash
2.0.1
- Fixed a bug where the generated when/map methods were potentially invalid when using default values
- Fixed a bug where when/map methods were generated even when not necessary
2.0.0
-
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
@unfreezedas a variant to@freezed, for mutable classes
1.1.0
Added support for disabling the generation of maybeMap/maybeWhen (thanks to @Lyokone)
1.0.0
freezed_annotation is now stable
0.15.0
-
Breaking Changed the syntax for
@Withand@Implementsto use a generic annotation. Before:@With(MyClass) @With.fromString('Generic<int>')After:
@With<MyClass>() @With<Generic<int>>()
0.14.3
Upgraded to support last json_annotation version
0.14.2
- Added the ability to specify a fallback constructor when deserializing unions (thanks to @Brazol)
0.14.1
- Added the ability to customise the JSON value of a union. See https://github.com/rrousselGit/freezed#fromjson---classes-with-multiple-constructors for more information (Thanks to @ookami-kb)
0.14.0
-
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'; }
0.13.0-nullsafety.0
-
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'; }
0.12.0
-
Added
Assertdecorator to generateassert(...)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
0.11.0
-
Added
@Withand@Implementsdecorators 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~
0.7.1
Minor change to @Default to fix an issue with complex default values.
0.7.0
Add @Default annotation
0.6.0
Added @late annotation.
0.4.0
Added a @nullable annotation.
0.3.1
Change version of collection to work with flutter_test.
0.3.0
Initial release of the annotation package.
Installing
export PUB_HOSTED_URL=https://pub.mirror.p-hatan.com
flutter pub add freezed_annotationpubspec.yaml
name: freezed_annotation
description: >
Annotations for the freezed code-generator.
This package does nothing without freezed too.
version: 3.1.0
repository: https://github.com/rrousselGit/freezed
issue_tracker: https://github.com/rrousselGit/freezed/issues
environment:
sdk: ">=3.0.0 <4.0.0"
dependencies:
collection: ^1.15.0
json_annotation: ^4.8.0
meta: ^1.7.0
dev_dependencies:
build_runner: ^2.3.3
json_serializable: ^6.3.2
test: ^1.21.0
Version history
| Version | Published | Archive | SHA-256 |
|---|---|---|---|
| 0.3.0 | 2020-02-13T17:29:00.416830Z | Download | 198f2be200dad8d5b036cb2a596a3d880218cfc0b4856755f0e94fee517ccfdb |
| 0.3.1 | 2020-02-13T17:36:07.041264Z | Download | 2fe6c869b77917d48774da4f0f89ada2e63cc89ba6ee2197cb261cb2a07265fb |
| 0.4.0 | 2020-02-13T22:24:39.479476Z | Download | c7a95b2545743f4bd571ccb5df2f18ab558435aa3b22d22fb00e3071c81b954a |
| 0.6.0 | 2020-02-15T17:55:13.565358Z | Download | 2dc4f1872a940b571c180b60563d17d77fdea605e529f6cec69385974a0c6b14 |
| 0.7.0 | 2020-02-21T19:17:02.792456Z | Download | 906de2bf8354b4b73b8229f133293b4537ff27f9393bdb519fdeb1ca17f2acfb |
| 0.7.1 | 2020-02-24T13:32:29.158232Z | Download | f9543bd4d0c488db5cd3159313083a4aa1d95b616aa6fd03cc5348dbae6b8e9c |
| 0.11.0-dev | 2020-06-01T01:59:41.058854Z | Download | 0fc137d2b35f8a41bfe72a2765cbbfa8056619137697687bebd14c70df423ee0 |
| 0.11.0 | 2020-06-13T15:02:34.699010Z | Download | bc1474cec64f981e3882b3c6ada9de99b16f5e5c6e327d94d31a2fe0f345035d |
| 0.11.0+1 | 2020-08-02T05:56:25.640712Z | Download | 11eecdb9dacfe2a3e93b03060f5c98d87cbb422295ddd07a2fa59cbd73165876 |
| 0.12.0 | 2020-09-19T21:37:32.537688Z | Download | f2a47f62acba5829cd8dffc76c0a0c8ec4e0cdf9665b2d48a2f017d92bb77f11 |
| 0.13.0-nullsafety.0 | 2021-01-23T14:30:00.123390Z | Download | 3c992c6c5a965187592e7baa645e7a931d4c2e25da9a755c0337bc3da874589a |
| 0.14.0 | 2021-03-04T11:34:03.245453Z | Download | cbd8c9e33672b76e06590f95151465f126182e963565dc07ccb0ffbd4899f796 |
| 0.14.1 | 2021-03-14T17:58:47.792680Z | Download | 07568a2bb30ec39b2ec2bbd308c8f1552375787f4c8f443c07e50e66d9c97d0d |
| 0.14.2 | 2021-05-13T10:06:06.414170Z | Download | 660c3d317449c61cfe85550964e9df78d3e08de4383d929ce6239dfa90124927 |
| 0.14.3 | 2021-07-17T03:44:26.037964Z | Download | 70776c4541e5cacfe45bcaf00fe79137b8c61aa34fb5765a05ce6c57fd72c6e9 |
| 0.15.0 | 2021-10-08T21:40:54.369408Z | Download | 02d17a242f724828a7c820921dbe92c66fe685d6bef3d7450dc556fa79e033ce |
| 1.0.0 | 2021-11-16T21:58:21.045637Z | Download | 2ea39b74fd730c6ab11673d16c9019503a727445790ea4ecec8baa6f6dce1bb8 |
| 1.1.0 | 2021-12-11T17:46:15.663538Z | Download | 1be037f901137bf2b9a0c309e9bf2694d6ec77687645211218191ade4f41a4b8 |
| 2.0.0 | 2022-04-19T12:45:08.096198Z | Download | 1a1ba6ef7bb4bfcb7101f605e5aac97a17dc771810014b91d7765523a6cf3b89 |
| 2.0.1 | 2022-04-20T07:47:54.048531Z | Download | bbffb1cc965cf9910afbbb9d24b9b95ef7b5a42564ce6d9439734dc0af3e6c9c |
| 2.0.3 | 2022-05-06T14:58:42.212927Z | Download | 5a5d169eaeb8e967974c4f80aa0e3fcb74cd9e1b8322b60b8f143755a3814d88 |
| 2.1.0 | 2022-07-15T12:28:14.747727Z | Download | 625eb228fd9f00f952b7cd245be34791434fad48375f74e46f97dea4b4e11678 |
| 2.2.0 | 2022-10-14T10:33:10.279286Z | Download | aeac15850ef1b38ee368d4c53ba9a847e900bb2c53a4db3f6881cbb3cb684338 |
| 2.4.1 | 2023-07-12T08:52:11.334866Z | Download | c3fd9336eb55a38cc1bbd79ab17573113a8deccd0ecbbf926cca3c62803b5c2d |
| 2.4.2 | 2024-07-02T08:07:05.382357Z | Download | f54946fdb1fa7b01f780841937b1a80783a20b393485f3f6cdf336fd6f4705f2 |
| 2.4.3 | 2024-07-09T05:03:09.952410Z | Download | f9f6597ac43cc262fa7d7f2e65259a6060c23a560525d1f2631be374540f2a9b |
| 2.4.4 | 2024-07-15T12:49:20.387326Z | Download | c2e2d632dd9b8a2b7751117abcfc2b4888ecfe181bd9fca7170d9ef02e595fe2 |
| 3.0.0 | 2025-02-25T19:16:06.236006Z | Download | c87ff004c8aa6af2d531668b46a4ea379f7191dc6dfa066acd53d506da6e044b |
| 3.1.0 | 2025-07-02T21:12:09.638932Z | Download | 7294967ff0a6d98638e7acb774aac3af2550777accd8149c90af5b014e6d44d8 |
Dependencies
collection "^1.15.0"
json_annotation "^4.8.0"
meta "^1.7.0"