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

GitHub 저장소gmpassos/data_serializer

data_serializer

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

data_serializer 프로젝트 이미지
스타
4
포크
0
최근 푸시(UTC)
2026. 8. 15.
프로젝트 상태
활성

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

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

Graciliano Monteiro Passos GitHub avatar
GitHub 작성자

Graciliano Monteiro Passos ↗

언어DartShell

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 7 개

프로젝트에 맞는 저장소를 선택하려면?

사용 목적에 따라 검색하고 개발 활동을 비교한 뒤 원본 저장소에서 요구 사항을 확인하세요.

  1. 이름, 작성자 또는 설명으로 검색하고 기술 주제로 범위를 좁힙니다.
  2. 스타, 포크, 최근 푸시를 함께 비교하세요. 스타는 관심의 지표이며 품질을 보장하지 않습니다.
  3. 사용하기 전에 GitHub에서 README, 라이선스, Issues를 확인하세요.

출처 및 관리

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗