cbor
6.5.2, released 2 weeks ago by darticulate.com
A Dart library for RFC8949‑compliant CBOR encoding and decoding.
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.
78Compare - qs_dart
A query string encoding and decoding library for Dart ported from JavaScript's qs.
77Compare - jwk
Encode and decode JSON Web Keys for use with the cryptography package
55Compare - charset
Charset encoding and decoding library for various text encodings in Dart.
50Compare
Works with
Packages commonly used together with cbor: ones it builds on, ones built on it, and its own family.
- typed_datacbor depends on itUtility functions and classes for easier work with dart:typed_data lists.
- convertcbor depends on itEncoders and decoders for converting between different data representations.
- characterscbor depends on itUnicode and grapheme cluster aware string manipulation operations for Dart.
- hexcbor depends on itProvides simple HEX.encode and HEX.decode functions for converting between byte lists and hexadecimal strings.
- ditto_liveBuilt on cborEdge sync SDK for Flutter enabling offline and online data synchronization across devices.
- pubnubBuilt on cborPubNub SDK for Dart and Flutter to build real-time messaging applications
- ndkBuilt on cborDart library for building Nostr clients with relay discovery, caching and signing support.
- connectanumBuilt on cborA Dart/Flutter client implementing the WAMP protocol for RPC and Pub/Sub.