Skip to content
pubscout

binary_codec

2.0.3, released 5 years ago by an unverified publisher

Dart library for converting standard data types to a binary format and back

WASM-ready
$ flutter pub add binary_codec
Source repository

What it does

It encodes supported primitive types, Uint8List, String, Map and List into a binary representation. It can also decode that binary back into the original Dart values.

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

Use it when

  • You need a simple way to serialize data for storage or network transmission without external dependencies
  • You work on a single platform or control both ends of the communication and can tolerate the dart2js int‑as‑double limitation

Skip it when

  • You require high‑performance streaming or large‑scale binary protocols
  • You need custom object serialization or schema evolution support

Strengths

  • Zero dependencies and pure Dart
  • Supports common Dart collections and primitive types
  • Null‑safe and works on all Flutter platforms

Weaknesses

  • No support for custom class serialization
  • No streaming or chunked encoding
  • No built‑in compression or encryption

Setup

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

void main() {
  final data = {'name': 'Alice', 'age': 30, 'active': true};
  final bytes = BinaryCodec.encode(data);
  final decoded = BinaryCodec.decode(bytes) as Map;
  print(decoded); // {name: Alice, age: 30, active: true}
}

Alternatives

Packages that do the same job and could replace binary_codec.

  • yaml

    A Dart library for parsing YAML documents into Dart data structures.

  • csv_plus

    Fast, zero-dependency CSV parser, encoder, streamer, and query engine for Dart.

  • conduit_codable

    A library for encoding and decoding dynamic structured data like JSON and YAML into Dart objects.

  • standard_message_codec

    Binary codec for efficient encoding/decoding of Dart objects without a schema.