Skip to content
pubscout

buffer

1.2.3, released 3 years ago by agilord.com

Utilities and classes for reading and writing byte buffers and binary data streams.

WASM-ready
$ flutter pub add buffer
Source repository

What it does

Provides ByteDataWriter and ByteDataReader classes to simplify reading and writing binary data formats. It allows working with byte sequences and streams efficiently, handling operations like reading/writing integers of various byte sizes and null-terminated byte sequences. It has zero external dependencies and runs on all Dart/Flutter platforms.

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

Use it when

  • Building custom binary protocol decoders or encoders.
  • Reading and writing structured binary data to or from byte buffers incrementally.
  • Handling null-terminated bytes and variable-length integer byte streams.

Skip it when

  • Working only with text-based formats like JSON or XML.
  • Standard Dart typed_data ByteData methods are sufficient for your simple buffer operations.

Strengths

  • Zero external dependencies.
  • Convenient sequential reader and writer APIs compared to manual index management with ByteData.
  • Cross-platform support across mobile, web, and desktop.

Weaknesses

  • README documentation is very brief with only a single minimal example.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0
final writer = ByteDataWriter();
writer.writeUint8(255);
writer.writeUint16(65535);
writer.writeUint32(4294967295);

final reader = ByteDataReader();
reader.add(writer.toBytes());
print(reader.readUint8());
print(reader.readUint16());
print(reader.readUint32());

Alternatives

Packages that do the same job and could replace buffer.

  • async

    Utility classes and helpers that extend Dart's async library.

  • stream_transform

    Extension methods adding common stream transform operators

  • gtk

    GTK utilities for Flutter Linux applications, providing settings and application lifecycle helpers.

  • flutter_flavorizr

    A utility to easily create and configure application flavors in Flutter.

Works with

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