Skip to content
pubscout

cbor

6.5.2, released 2 weeks ago by darticulate.com

A Dart library for RFC8949‑compliant CBOR encoding and decoding.

WASM-readyRock solid
$ flutter pub add cbor
Source repository

What it does

It provides APIs to encode Dart objects to CBOR binary format and decode CBOR data back to Dart objects. Supports indefinite length, streaming, and advanced types like rational numbers.

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

Use it when

  • You need compact binary serialization for IoT or low‑bandwidth communication
  • You require CBOR support with streaming or custom tag handling

Skip it when

  • You only need JSON serialization
  • You prefer a code‑generated model layer

Strengths

  • RFC8949 compliant
  • Streaming support and indefinite length handling
  • Rich type system with tags and rational numbers

Weaknesses

  • No code‑gen integration
  • Limited to CBOR – not a general-purpose serializer

Setup

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

void main(){
  final encoded = cbor.encode(CborMap({CborSmallInt(1): CborSmallInt(2)}));
  print(encoded); // [0xa2, 0x01, 0x02]
}

Alternatives

Packages that do the same job and could replace cbor.

  • pem

    PEM encoding and decoding of textual keys and certificates following RFC 7468.

  • qs_dart

    A query string encoding and decoding library for Dart ported from JavaScript's qs.

  • jwk

    Encode and decode JSON Web Keys for use with the cryptography package

  • charset

    Charset encoding and decoding library for various text encodings in Dart.

Works with

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