talira

built_value

Immutable value types, enum classes and JSON serialization for Dart, by code generation

open sourceBSD-3-Clausefree

built_value is Google's Dart library for immutable value types: classes that compare equal when their fields are equal, with builders for creating and changing copies. It also provides EnumClass, classes that behave like enums, and JSON serialization for both, with immutable collections from built_collection. The code is generated by built_value_generator through build_runner, once or in watch mode. It came out of the same problems as AutoValue for Java and is used on client and server alike.

Problems it solves

  • make immutable model classes in Dart without writing equality by hand
  • serialize Dart objects to JSON with generated code
  • enums with methods and serialization in Flutter

Features

  • Immutable value types with builders
  • EnumClass: classes that behave like enums
  • JSON serialization for value types and enums
  • Immutable collections through built_collection
  • Code generated with build_runner, one-off or in watch mode

Alternatives

The same job

These do what built_value does.

  1. Freezed Code generation for immutable data classes and unions in Dart
  2. equatable A Dart package that helps to implement value based equality without needing to explicitly override == and hashCode

Compare built_value with the top 3