dogs_core 2.1.0 dogs_core: ^2.1.0 copied to clipboard
a universal serialization library using code generation to reduce boilerplate massively.
DOGs
DOGs, short for Dart Object Graphs, is a universal serialization library for dart making strong use of code generation to reduce boilerplate massively. Dogs can be easily extended to support a wide array of encodings and comes with json support out of the box.
@serializable
class Person {
@LengthRange(max: 128)
final String name;
@Minimum(18)
final int age;
@SizeRange(max: 16)
@Regex("((_)?[a-z]+[A-Za-z0-9]*)+")
final Set<String>? tags;
Person(this.name, this.age, this.tags);
}
Features #
- Builder extensions (supporting nullability)
- Copyable types (supporting map overrides)
- OpenApi Schema Generation (using conduit_open_api)
- Validation API (similar to javax.validation)
- Generator-less external extensibility
Format Support #
- JSON (included in dogs_core)
- YAML (package dogs_yaml)
- TOML (package dogs_toml)
- CBOR (package dogs_cbor)
Silent Code Generation #
A neat point about dogs 'darwin like' non-intrusive code generation is, that it has almost zero boilerplate and generally doesn't require importing or referencing generated source code, except for just a few cases. This allows you to keep on working on your code, without having to wait for the build runner to create your required files for every new service you create and plan to use. This also minimizes conflicts with other external generators and helps to prevent unexpected build runner crashes.