Giter Site home page Giter Site logo

helightdev / dogs Goto Github PK

View Code? Open in Web Editor NEW
10.0 1.0 0.0 3.06 MB

an object mapping and serialization library that uses code generation to create a structure definition of your serializable classes, which is usable at runtime.

Home Page: https://dogs.helight.dev

License: Apache License 2.0

Dart 98.28% Shell 0.96% HTML 0.76%
dart serialization generator dataclass json odm object-mapper

dogs's Introduction

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.

Documentation | Discord | Pub Package

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.