freezed 0.15.1 copy "freezed: ^0.15.1" to clipboard
freezed: ^0.15.1 copied to clipboard

outdated

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

0.15.1 #

  • The union key is no longer passed json_serializable when deserializing avoid the case of being an unrecognized_key in some cases.
  • Updated dependencies
  • Increased minimum Dart SDK required to 2.14.0
  • Fixed an issue where classes with a $ in their name could cause Freezed to fail (Thanks to @comigor #542)
  • When using typedefs, the generated code now tries to use the typedef too if possible, instead of the aliased type (Thanks to @Norbert515 #536).
  • Added support for custom ==/hashCode implementation (Thanks to @casvanluijtelaa #526)
  • When writing a custom toJson function, it will now always take precedence over the default implementation generated by Freezed.

0.15.0+1 #

Fixed the generated hashCode not compiling for objects with a large number of properties. (#531)

0.15.0 #

  • 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.

0.14.5 #

  • fixed a bug when using alias imports, potentially using the prefix on every variables.
  • When @Freezed(fallback: '...') is specified and using fromJson, now support cases where the JSON does not contain the "key".

0.14.4 #

  • Now supports types coming from import '...' as alias;
  • generated .freezed.dart are now excluded from code coverage reports.
  • if toString is overriden, Freezed no-longer applies Diagnosticable which would break the toString (fixes #221)
  • Add union.whenOrNull and union.mapOrNull, similar to maybeWhen and maybeMap but instead of an orElse they return null.

0.14.3 #

  • Upgraded to support json_serializable 5.0.0
  • fromJson now throws CheckedFromJsonException if it fails to deserialize an object.
  • fixed an issue where optional dynamic keys were not allowed.

0.14.2 #

  • Added the ability to specify a fallback constructor when deserializing unions (thanks to @Brazol)

0.14.1+3 #

Upgrade dependencies

0.14.1+2 #

Fixed examples in the README

0.14.1+1 #

  • Fixed issues with recursive Freezed classes that could cause the parameter type to be inferred as dynamic (see #399)
  • Updated build and other similar dependencies to latest

0.14.1 #

0.14.0+2 #

  • Fix @Assert no-longer working
  • Fixed an issue where a factory using the => syntax (so not managed by Freezed) with default values could break code-generation.

0.14.0+1 #

  • fix sort_unnamed_constructors_first and cast_nullable_to_non_nullable in the generated code (Thanks to @gaetschwartz #372)

0.14.0 #

  • 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).

0.14.0-nullsafety.1 #

  • Upgraded analyzer to support latest versions

0.14.0-nullsafety.0 #

  • 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
    }
    

0.13.0-nullsafety.2 #

  • Excluded getters and late variables from the generated toString as they could potentially cause a StackOverflow

0.13.0-nullsafety.1 #

  • Fixed a bug causing properties with annotations to generate the annotations before the `required keyword, leading to a compilation error (see #351).

0.13.0-nullsafety.0 #

Migrated to null safety

0.12.7 #

0.12.6 #

0.12.5 #

0.12.4 #

0.12.3 #

0.12.3-dev #

0.12.2 #

0.12.1 #

  • Removed dependency on _fe_analyzer_shared

0.12.0 #

  • 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

0.11.6 #

0.11.5 #

  • Fixed a bug in which case Freezed generated an invalid copyWith implementation

0.11.4 #

  • No-longer generate when/... for private constructors.

0.11.3 #

  • Fixed a bug where the generated class incorrectly used Diagnosticable event if package:flutter/foundation wasn't imported. (Thanks to @avbk)

0.11.2 #

  • Generate when/map/... even for classes with a single constructors (thanks @andrzejchm)

0.11.1 #

  • Further improve the parsing of recursive freezed class to avoid dynamics

0.11.0 #

  • 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)

0.10.9 #

  • Fixes a bug where code-generation could end-up in a Stack Overflow if a class depends on itself

0.10.8 #

0.10.7 #

0.10.6 #

  • do not create @required annotation for positional arguments on when/map functions (thanks to @hpoul)
  • Fix == returning false for classes with "other" prop (thanks to @mhmdanas)

0.10.5 #

Fixes classes with getters and a private MyClass._() constructor not properly generating.

0.10.4 #

Fixed Freezed trying to generate code for factory constructors with a complex body.

0.10.3 #

  • Fixes Freezed trying to generate code for files that don't use it

0.10.2 #

  • Fixes a bug where deep copy did not compile if the class definitions were spread on multiple files.

0.10.1 #

  • Fixed a stack-overflow during generation on recursive classes
  • Fixed invalid generated code for classes with a concrete constructor + using Diagnosticable

0.10.0 #

  • Consider optional parameters with a default value as non-nullable
  • Add deep-copy support
  • Allow the class to define methods/getters
  • Do not override toString if the user-defined class already overrides toString

0.9.2 #

Fixes parsing of recursive classes

0.9.1 #

Support enum and static const default values

0.9.0 #

Support class-level decorators (see https://github.com/rrousselGit/freezed/issues/50)

0.8.2 #

Generated file now ignores invalid_override_different_default_values_named

0.8.0 #

Now also generate constructor tear-off.

0.7.3 #

Fixes @Default generating invalid code if the default value explicitly used const.

0.7.2 #

Fix null/bool default value support

0.7.1 #

Fixes a bug where @Default only worked with strings/numbers/functions/types.

0.7.0 #

Add support for default values

0.6.3 #

0.6.2 #

  • Fixes an issue with inconsistent hashCode when using collections
  • Fixes a parsing bug with complex concrete factory constructors.

0.6.1 #

Fixed a bug where @late could incorrectly parse the getter

0.6.0 #

Add support for cached getters using @late.

0.5.1 #

  • Document @nullable
  • fix a bug where static members where not allows (thanks @knaeckeKami)

0.5.0 #

The generated == now works with collections too.

If a class created has a List/Map/Set/Iterable, then the == will deeply compare these instead of comparing their reference.

0.4.0 #

Automatically generate assert(property != null) on both constructors and copyWith methods.
This also adds a @nullable decorator to disable this assertion.

0.3.0 #

Now use a custom @freezed annotation instead of @immutable.

0.2.5 #

Fixed a bug where generic json deserialization didn't apply generic parameters (https://github.com/rrousselGit/freezed/issues/32)

0.2.4 #

Make the generated interface a mixin to fix prefer_mixin lints (https://github.com/rrousselGit/freezed/issues/28)

0.2.3 #

Fixes a bug where constructors with generic parameters caused the parsing of the redirected constructor to fail. (https://github.com/rrousselGit/freezed/issues/25)

0.2.2 #

Fixes a bug where the code would not compile if a property had the same name as a named constructor.

0.2.1 #

Fixes a bug where classes with a single constructor + fromJson did not generate properties/copyWith.

0.2.0 #

Transfer all parameters decorators to the generated properties.

0.1.4 #

  • Fixed a bug where map/maybeMap on generic classes didn't pass the generic parameters.

0.1.3+1 #

  • Fix README's index

0.1.3 #

0.1.2 #

0.1.1 #

Upgrade min range of analyzer dependency

0.1.0 #

Add support for json_serializable

0.0.2 #

Implicitly generate debugFillProperties if the necessary classes are imported.

0.0.1 #

Add generic support

0.0.0 #

Initial release

3631
likes
0
pub points
99%
popularity

Publisher

verified publisherdash-overflow.net

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

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

analyzer, build, build_config, collection, freezed_annotation, meta, source_gen

More

Packages that depend on freezed