built_value 0.1.5 copy "built_value: ^0.1.5" to clipboard
built_value: ^0.1.5 copied to clipboard

outdatedDart 1 only

Value types with builders. This library is the runtime dependency.

Built Values for Dart #

Build Status

Introduction #

Built Values provides immutable "value types" for Dart and is part of Libraries for Object Oriented Dart.

Value Types #

Value types are, for our purposes, classes that are considered interchangeable if their fields have the same values.

Common examples include Date, Money and Url. Most code introduces its own value types. For example, every web app probably has some version of Account and User.

Value types are very commonly sent by RPC and/or stored for later retrieval.

Motivation #

The problems that led to the creation of the Built Value library have been discussed at great length in the context of AutoValue for Java.

In short: creating and maintaining value types by hand requires a lot of boilerplate. It's boring to write, and if you make a mistake, you very likely create a bug that's hard to track down.

Any solution for value types needs to allow them to participate in object oriented design. Date, for example, is the right place for code that does simple date manipulation.

AutoValue solves the problem for Java with code generation, and Built Values does the same for Dart. The boilerplate is generated for you, leaving you to specify which fields you need and to add code for the behaviour of the class.

Examples #

See this example for a full project with a build.dart and some example value types.

Features and bugs #

Please file feature requests and bugs at the issue tracker.

665
likes
0
pub points
100%
popularity

Publisher

verified publishergoogle.dev

Value types with builders. This library is the runtime dependency.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

quiver

More

Packages that depend on built_value