dogs_core
DX에 초점을 맞춘 유니버설 객체 매핑 및 직렬화 라이브러리.
코드 생성된 객체 그래프를 위한 Dart/Flutter 라이브러리로, 보일러플레이트 없는 직렬화, 검증, 프로젝션 및 다형성을 제공하며, Flutter 폼과 데이터 바인딩을 지원합니다.
{"sdk":"flutter"}^7.4.1아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
DOGs (Dart Object Graphs) is a serialization and object-mapping library for Dart that turns your classes into introspectable, immutable, and easily validated data models across multiple formats.
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);
}
Json
The core package comes with json support out of the box and requires no additional dependencies.
Builders & Nullable Copy
We provide a nullable copy method that also works with null values, as well as autogenerated builders, similar to
built_value. Both let you create immutable objects with a simple and fluent api.
Structures
Every serializable class has an introspectable generated DogStructure that provides runtime access to the class's
fields, annotations, factories and metadata. Together with the extensible core system, you can build powerful
reflection-like functionality without the need for custom code generation or mirrors.
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, that is hard to maintain and distracting.
Projections
Dogs offers a powerful projection api, which enables you to transform your objects into
other objects, without having to write additional boilerplate code with brittle copyWith
invocations and hard coded key names.
Polymorphism
Dogs supports polymorphic serialization, which enables 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. Translation of messages and
custom validators are supported as well.
JsonSchema-like Schema (preview)
Dogs offers a schema generation api, which allows you to dynamically export and parse a subset
of json-schema. This enables advanced dynamic uses cases such as partially server-driven forms when used
in combination with the flutter integration.
Package on pub.dev
Documentation
Use our flutter integration to easily create forms for any serializable object, without having
to write boilerplate code. The databinding system supports all primitive field types and can easily
be extended to support custom field types and layouts. This package also provides converters for
commonly used flutter types, like Color, Offset, Size, Rect, etc.
Package on pub.dev
Documentation
Dogs takes a different approach to generated code. Instead of scattering part files across your models, all generated output lives in a single dogs.g.dart file at the root of your lib folder. This makes development smoother and far less error-prone. No more missing part statements or fragile imports.
Even better: your model definitions stay clean. You never need to reference generated code inside them. The only time you’ll interact with generated code directly is when using builders, which are neatly exported through the central dogs.g.dart.
This design keeps Dogs non-intrusive and future-proof. While part files may be added later for flexibility, you will never be required to reference generated code from within your model definition files.