패키지, 저장소 및 앱 카테고리 검색

패키지 상세v10.2.0

dogs_core

DX에 초점을 맞춘 유니버설 객체 매핑 및 직렬화 라이브러리.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
294
좋아요
12
Pub 점수
140

패키지 설치

flutter pub add dogs_core

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

dogs_core는 효율적인 객체 매핑과 시리얼라이제이션을 위한 Dart 패키지로, 개발자 경험(DX)을 우선시합니다. 코드 생성을 활용하여 최소한의 뼈대 코드로 Dart 객체와 JSON 간의 원활한 변환을 가능하게 하며, 타입 안전성과 성능을 보장합니다. Android, iOS, Web, macOS, Windows, Linux를 포함한 모든 주요 Flutter 대상 플랫폼을 지원하며, 크로스플랫폼에서 강력한 데이터 처리가 필요한 앱에 적합합니다. API 및 로컬 데이터 모델 작업을 단순화하기 위해 자동으로 시리얼라이제이션 로직을 생성합니다.

사용 사례

  • API 데이터 파싱
  • 로컬 상태 관리
  • 크로스 플랫폼 데이터 지속성
  • 모델 변환
  • 실시간 데이터 동기화
  • 구성 로드

주요 기능

  • 코드 생성 시리얼라이제이션
  • 제로 런타임 오버헤드
  • 타입 안전한 매핑
  • 최소한의 보일러플레이트
  • 모든 플러터 플랫폼을 지원합니다
  • 확장 가능한 주석 시스템

적합한 대상

  • 빠른 직렬화를 찾는 개발자
  • 복잡한 데이터 모델을 가진 프로젝트
  • DX를 우선시하는 팀
  • 다중 플랫폼 플러터 앱
  • JSON API에 의존하는 앱

고려 사항

  • 코드 생성 단계가 필요합니다
  • annotation에 대한 학습 곡선
  • build_runner에 대한 종속성
  • 제한된 런타임 사용자 정의
  • 동적 데이터 구조에 적합하지 않습니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Frosty Dart Object Graphs pub Build gitbook

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);

}
  • 🐦 Concise Define immutable dataclasses with a simple annotation and mixin. toString, equals, hashCode, and builders are generated automatically. No equatable, no copyWith, no additional boilerplate.
  • 🚀 Fast Optimized serialization and deserialization with performance on par or better than alternatives. JSON support is built in with zero extra dependencies.
  • 🧩 Extensible Replace or extend any part of the pipeline. Add new formats, validators, projections, or field converters. Works with custom Flutter types through the integration package.
  • 📦 Adaptive Multiple formats supported out of the box: JSON, YAML, TOML, CBOR. Schema generation enables dynamic use cases like server-driven forms.
  • 📚 Documented Comprehensive documentation and examples
  • ⚡ Developer-friendly All generated code goes into a single dogs.g.dart. Models remain clean and free of part directives. Builders and nullable copy methods are exposed centrally.

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 & 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

Flutter pub

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

✨ Non-Intrusive Code Generation ✨

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.

카테고리

의존성

의존성 목록 4 개

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.