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

패키지 상세v2.1.0

yaml_writer

YAML 문서를 작성하기 위한 라이브러리로, 객체 인코딩과 'dart:convert'의 'Converter'를 지원합니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
66.6만
좋아요
29
Pub 점수
160

패키지 설치

flutter pub add yaml_writer

패키지 개요

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

yaml_writer는 객체 인코딩을 지원하고 'dart:convert' Converter 인터페이스와 통합할 수 있도록 설계된 Dart 라이브러리입니다. Dart 객체를 구조화된 YAML 형식으로 원활하게 직렬화할 수 있게 해주며, 구성 파일, 데이터 교환 및 지속적 저장에 적합합니다. 이 패키지는 Android, iOS, Web, macOS, Windows, Linux 등 모든 주요 플랫폼에서 호환됩니다. 간단함과 상호 운용성을 중시하며 표준 Dart 생태계를 확장하면서도 깨끗하고 읽기 쉬운 출력을 유지합니다.

사용 사례

  • 구성 파일 생성
  • Dart 객체를 YAML로 직렬화하기
  • YAML 형식의 데이터 지속성
  • dart:convert와의 상호 운용성
  • 구조화된 데이터 내보내기 생성

주요 기능

  • 객체 인코딩 지원
  • dart:convert Converter와의 통합
  • 크로스 플랫폼 호환성
  • 깨끗하고 읽기 쉬운 YAML 출력
  • YAML 문서 작성용 간단한 API

적합한 대상

  • 구성 데이터를 다루는 개발자
  • YAML 출력이 필요한 응용 프로그램
  • dart:convert 유틸리티를 사용하는 프로젝트
  • 크로스 플랫폼 플러터 앱
  • 구조화된 텍스트 직렬화가 필요한 도구

고려 사항

  • YAML 작성에 한정됨(분석 불가)
  • 완전한 기능을 위해 외부 종속성에 의존합니다
  • 대규모 YAML 생성을 위한 최적화되지 않음
  • 입력 객체에 내장된 검증 없음
  • 복잡한 중첩 구조를 수동으로 처리해야 합니다

원본 README

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

yaml_writer

pub package Null Safety Codecov Dart CI GitHub Tag New Commits Last Commits Pull Requests Code size License

A library to write YAML documents, supporting Object encoding and dart:convert Converter.

Usage

A simple usage example:

import 'package:yaml_writer/yaml_writer.dart';

void main() {
  final yamlWriter = YamlWriter();

  final yamlDoc = yamlWriter.write({
    'name': 'Joe',
    'ids': [10, 20, 30],
    'desc': 'This is\na multiline\ntext',
    'enabled': true,
  });

  print(yamlDoc);
}

OUTPUT:

name: "Joe"
ids: 
  - 10
  - 20
  - 30
desc: |-
    This is
    a multiline
    text
enabled: true

YAML Strings

The writer will try to encode strings using the best format depending on the text, avoiding to escape " and using | for multiline texts.

Encoding Objects

You can use YAMLWriter.toEncodable to convert an Object to an encodable version, similar to what is done by dart:convert JsonEncoder.

If YAMLWriter.toEncodable is not set, it will try to call toJson().

Features and bugs

Please file feature requests and bugs at the issue tracker.

Author

Graciliano M. Passos: gmpassos@GitHub.

Liplum: liplum@GitHub

License

Dart free & open-source license.

카테고리

소스 저장소

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