Skip to content
pubscout

binarize

2.0.0, released 2 years ago by wolfenrain.dev

Streamlined and extendable binary data creation and reading.

WASM-ready
$ flutter pub add binarize
Source repository

What it does

Binarize wraps ByteData functionality into a streamlined payload system for reading and writing binary data. It prevents manual byte offset calculations and supports custom payload types and strongly typed binary contracts for Dart classes.

AI-written summary of version 2.0.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You are implementing a binary file format specification.
  • You need to serialize and deserialize custom Dart objects into binary buffers efficiently.

Skip it when

  • You only need high-level text serialization like JSON.
  • You require complex state management or database storage.

Strengths

  • Simplifies reading and writing with ByteData without manual offset tracking.
  • Supports custom payload types and strongly typed binary contracts.

Weaknesses

  • Requires manual ordering of reads and writes to match the binary structure.
  • Niche use case limited to binary file formats and custom binary serialization.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0
import 'package:binarize/binarize.dart';

void main() {
  final writer = Payload.write()
    ..set(uint8, 16)
    ..set(string.utf8(), 'Hello World');

  final bytes = binarize(writer);

  final reader = Payload.read(bytes);
  final aUint8 = reader.get(uint8);
  final aString = reader.get(string.utf8());
}

Works with

Packages commonly used together with binarize: ones it builds on, ones built on it, and its own family.