Viewing version 3.0.0. Open the latest package page.
freezed_annotation
3.0.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.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.ir
flutter pub add 'freezed_annotation:3.0.0'pubspec.yaml
name: freezed_annotation
description: >
Annotations for the freezed code-generator.
This package does nothing without freezed too.
version: 3.0.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 | Cached · Upstream SHA-256 matched | Download | 198f2be2…7ccfdb |
| 0.3.1 | Cached · Upstream SHA-256 matched | Download | 2fe6c869…7265fb |
| 0.4.0 | Cached · Upstream SHA-256 matched | Download | c7a95b25…1b954a |
| 0.6.0 | Cached · Upstream SHA-256 matched | Download | 2dc4f187…0c6b14 |
| 0.7.0 | Cached · Upstream SHA-256 matched | Download | 906de2bf…f2acfb |
| 0.7.1 | Cached · Upstream SHA-256 matched | Download | f9543bd4…6b8e9c |
| 0.11.0-dev | Cached · Upstream SHA-256 matched | Download | 0fc137d2…423ee0 |
| 0.11.0 | Cached · Upstream SHA-256 matched | Download | bc1474ce…45035d |
| 0.11.0+1 | Cached · Upstream SHA-256 matched | Download | 11eecdb9…165876 |
| 0.12.0 | Cached · Upstream SHA-256 matched | Download | f2a47f62…b77f11 |
| 0.13.0-nullsafety.0 | Cached · Upstream SHA-256 matched | Download | 3c992c6c…74589a |
| 0.14.0 | Cached · Upstream SHA-256 matched | Download | cbd8c9e3…99f796 |
| 0.14.1 | Cached · Upstream SHA-256 matched | Download | 07568a2b…c97d0d |
| 0.14.2 | Cached · Upstream SHA-256 matched | Download | 660c3d31…124927 |
| 0.14.3 | Cached · Upstream SHA-256 matched | Download | 70776c45…72c6e9 |
| 0.15.0 | Cached · Upstream SHA-256 matched | Download | 02d17a24…e033ce |
| 1.0.0 | Cached · Upstream SHA-256 matched | Download | 2ea39b74…ce1bb8 |
| 1.1.0 | Cached · Upstream SHA-256 matched | Download | 1be037f9…41a4b8 |
| 2.0.0 | Cached · Upstream SHA-256 matched | Download | 1a1ba6ef…cf3b89 |
| 2.0.1 | Cached · Upstream SHA-256 matched | Download | bbffb1cc…3e6c9c |
| 2.0.3 | Cached · Upstream SHA-256 matched | Download | 5a5d169e…814d88 |
| 2.1.0 | Cached · Upstream SHA-256 matched | Download | 625eb228…e11678 |
| 2.2.0 | Cached · Upstream SHA-256 matched | Download | aeac1585…684338 |
| 2.4.1 | Cached · Upstream SHA-256 matched | Download | c3fd9336…3b5c2d |
| 2.4.2 | Cached · Upstream SHA-256 matched | Download | f54946fd…4705f2 |
| 2.4.3 | Cached · Upstream SHA-256 matched | Download | f9f6597a…0f2a9b |
| 2.4.4 | Cached · Upstream SHA-256 matched | Download | c2e2d632…595fe2 |
| 3.0.0 | Cached · Upstream SHA-256 matched | Download | c87ff004…6e044b |
| 3.1.0 | Cached · Upstream SHA-256 matched | Download | 7294967f…6d44d8 |
Dependencies
collection "^1.15.0"
json_annotation "^4.8.0"
meta "^1.7.0"