dogs_core 8.1.1 copy "dogs_core: ^8.1.1" to clipboard
dogs_core: ^8.1.1 copied to clipboard

universal object mapping and serialization library with a focus on dx.

Frosty Dart Object Graphs pub Build gitbook

DOGs, short for Dart Object Graphs, is a object mapping and serialization library that use code generation to create a structure definition of your serializable classes, which is usable at runtime.

@serializable
class Person with Dataclass<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);

}
  • 🐦 Concise Write expressive code with effectively zero boilerplate
  • 🚀 Fast Similar or increased performance compared to alternatives
  • 🧩 Extensible Modify and customize any part of your serialization
  • 📦 Adaptive Use one of the various formats or bring your own
  • 📚 Documented Comprehensive documentation and examples
  • Unmatched DX No part files, no dollar signs, no getters, no hassle

Format Support #

  • JSON (included in dogs_core)
  • YAML pub
  • TOML pub
  • CBOR pub

Core Package pub #

  • Json
    The core package comes with json support out of the box and requires no additional dependencies.

  • Builders
    We provide autogenerated builders, similar to built_value, which allow you to easily create immutable objects with a fluent api.

  • Dataclasses
    Using our dataclass mixin automatically implements toString, equals and hashCode for your serializable classes. This removes the requirement for a package like equatable or ungodly amounts of boilerplate code.

  • Projections
    Dogs offers a powerful projection api, which allows you to transform your objects into other objects, without having to write additional boilerplate code.

  • Polymorphism
    Dogs supports polymorphic serialization, which allows you to serialize and deserialize objects of different types. You can even use interfaces and abstract classes as types, including Object.

  • Validation
    Using the validation api, you can easily validate your objects, without having the struggle of writing your own validation logic for most common use cases.

  • OpenApi Schema (preview)
    Dogs offers a schema generation api, which allows you to generate an OpenApi schema for your objects, to be used with OpenApi tools like Swagger.

Package on pub.dev
Documentation

Firestore pub #

Dogs offers a firestore api, which allows you to easily create firestore documents from your serializable objects and vice versa. You can either use our lightweight extensions on the Firestore classes or make use of our entity api, which offers you a simplified and more object oriented way of interacting with firestore.
Package on pub.dev
Documentation

Forms pub #

Use our forms api to easily create forms for any serializable object, without having to write boilerplate code. The package uses flutter_form_builder under the hood, so you can benefit from its large ecosystem of form fields.
Package on pub.dev
Documentation

✨ Fancy Code Generation ✨ #

Dogs doesn't use part files for generated code but instead generated files for all serializable classes, which then get exported in the dogs.g.dart file at the root of your lib folder. This massively improves the developer experience, as you don't have to write annoying part statements with missing files everytime. In fact, you don't need do import anything generated in your model files at all! Generally, the api of dogs is designed to be independent of generated code, where it makes sense. All serialization and deserialization methods don't require any reference to generated code and can be used without any imports. The only exception to this are the builders, which are generated for each serializable class and require the dogs.g.dart file to be imported.

6
likes
0
pub points
32%
popularity

Publisher

verified publisherhelight.dev

universal object mapping and serialization library with a focus on dx.

Repository (GitHub)
View/report issues

Topics

#serialization #dataclass #json #orm

Documentation

Documentation

License

unknown (license)

Dependencies

collection, conduit_open_api, lyell, meta

More

Packages that depend on dogs_core