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

패키지 상세v1.2.3

data_serializer

데이터 직렬화/역직렬화를 효율적으로 처리할 수 있는 이동 가능한 Dart 패키지로, 데이터 읽기 및 쓰기에 사용할 수 있는 동적 BytesBuffer 포함.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
1.3만
좋아요
3
Pub 점수
150

패키지 설치

flutter pub add data_serializer

패키지 개요

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

효율적인 데이터 직렬화 및 역직렬화를 위한 휴대용 Dart 패키지로, 바이너리 데이터의 저수준 읽기 및 쓰기를 위한 동적 BytesBuffer를 제공합니다. 객체와 직렬화된 형식 간의 변환을 간소화하도록 설계되었으며, 안드로이드, iOS, 웹, macOS, Windows, 리눅스 등 다양한 플랫폼에서 크로스플랫폼 사용을 지원합니다. 최소한의 오버헤드로 고성능 데이터 처리가 필요한 애플리케이션에 이상적입니다. 네트워크 통신, 파일 저장, 실시간 데이터 교환과 같은 시나리오에서는 속도와 신뢰성이 중요한 경우에 특히 유용합니다.

사용 사례

  • 이진 데이터 전송
  • 파일 형식 파싱
  • 실시간 데이터 처리
  • 다중 플랫폼 간 데이터 공유
  • 네트워크 프로토콜 구현

주요 기능

  • 동적 BytesBuffer
  • 효율적인 직렬화
  • 크로스 플랫폼 지원
  • 저수준 데이터 조작
  • 고성능

적합한 대상

  • 고성능 앱
  • 네트워크 집약형 애플리케이션
  • 임베디드 시스템
  • 데이터 집약적인 워크플로우
  • 사용자 지정 이진 형식

고려 사항

  • 이진 데이터에 대한 이해가 필요합니다
  • 사용자 정의 로직 없이 기본 유형에 제한됨
  • 복잡한 JSON 구조에 적합하지 않습니다
  • 수동 유형 관리 필요
  • 저수준 작업의 학습 곡선

원본 README

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

data_serializer

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

Portable Dart package to handle data serialization/deserialization efficiently, including a dynamic BytesBuffer to read/write data.

API Documentation

See the API Documentation for a full list of functions, classes and extension.

Usage

import 'package:data_serializer/data_serializer.dart';

void main() {
  // Dynamic bytes buffer with initial capacity of 16 bytes.
  var buffer = BytesBuffer(16);

  // Write a unsigned int of 32 bits:
  buffer.writeInt32(0x10203040);

  // Write a `String` encoded using UTF-8:
  buffer.writeString('Hello!');

  // Write a unsigned int of 64 bits:
  buffer.writeUint64(9223372036854775807);

  // Write a data block (prefixed by 4 bytes for he data length).
  var dataBlock = [110, 120, 130, 140, 150, 160].toUint8List();
  buffer.writeBlock32(dataBlock);

  // Write all bytes:
  buffer.writeAll([210, 220]);

  // The current length of the buffer, expanded automatically:
  print('length: ${buffer.length}');

  // Change the current position cursor to `0`:
  buffer.seek(0);

  // Read a 32 bits int:
  var n32 = buffer.readUint32();
  print('n32: 0x${n32.toHex32()}');

  // Reads a `String` decoding from UTF-8:
  var s = buffer.readString();
  print('s: $s');

  // Read a 64 bits int:
  var n64 = buffer.readUint64();
  print('n64: $n64');

  // The current buffer position:
  print('position: ${buffer.position}');

  // Read a data block:
  var dataBlock2 = buffer.readBlock32();
  print('dataBlock2: $dataBlock2');

  // The position after read the data block:
  print('position: ${buffer.position}');

  // The remaining bytes in the buffer:
  var tailBytes = buffer.readRemainingBytes();
  print('tailBytes: $tailBytes');
}

OUTPUT:

length: 34
n32: 0x10203040
s: Hello!
n64: 9223372036854775807
position: 22
dataBlock2: [110, 120, 130, 140, 150, 160]
position: 32
tailBytes: [210, 220]

Browser/JavaScript compatibility

All the operations are tested to be compatible with JavaScript.

Note that JS only supports 53-bits integers. To avoid any issue serializing 64-bits integers, try to use BigInt serialization, or ensure that you are bellow the 53-bits range.

See the class DataSerializerPlatform if you need runtime information about integers support.

Test Coverage

Codecov

This package aims to always have a high test coverage percentage, over 95%. With that the package can be a reliable tool to support your important projects.

Source

The official source code is hosted @ GitHub:

  • https://github.com/gmpassos/data_serializer

Features and bugs

Please file feature requests and bugs at the issue tracker.

Contribution

Any help from the open-source community is always welcome and needed:

  • Found an issue?
    • Please fill a bug report with details.
  • Wish a feature?
    • Open a feature request with use cases.
  • Are you using and liking the project?
    • Promote the project: create an article, do a post or make a donation.
  • Are you a developer?
    • Fix a bug and send a pull request.
    • Implement a new feature.
    • Improve the Unit Tests.
  • Have you already helped in any way?
    • Many thanks from me, the contributors and everybody that uses this project!

If you donate 1 hour of your time, you can contribute a lot, because others will do the same, just be part and start with your 1 hour.

Author

Graciliano M. Passos: gmpassos@GitHub.

License

Apache License - Version 2.0

카테고리

의존성

의존성 목록 2 개

소스 저장소

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