cbor 3.2.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 86

cbor #

Build Status

A CBOR library for Dart developers.

This package provides an encoding/decoding package for the Concise Binary Object Representation as documented in RFC7049.

CBOR is increasingly used as a line protocol in the IOT world where the overhead of transmitting JSON on constrained devices can be large in packet size and processing overheads.

The Cbor package provides an RFC7049 compliant solution for both the encoding and decoding of CBOR data.

The test suite supports the encoding and decoding examples in Appendix A of RFC7049 amongst others. Specifically :-

  1. Half, Single and Double precision floats are supported.
  2. Tag based encoding is supported(table 3 of the RFC).
  3. Indefinite item encoding/decoding is supported.
  4. Items can be nested to any level.
  5. All Major tag types are supported.
  6. Smallest size first is used, i.e. if an int can be encoded in one byte then this size is used, similarly a double will be encoded into its smallest precision size(unless you specify otherwise);

The implementation of maps restricts map keys to be of a non-iterable type such as string or integer, note however that at the moment decoding to JSON will fail if map keys are not strings.

Please examine the files in the examples directory for usage examples and the API docs for greater detail.

In general the package guarantees to decode what it encodes and should decode all well formed CBOR data. Decoded output takes the form of standard Dart types, i.e. floats become doubles, text become String, arrays become Lists etc. This allows a simple interface for encoding from the Dart world and a simple interface to Dart world from the decoder.

Currently the package supports a payload based decoding, i.e. a complete CBOR entity needs to be submitted to the decoder. Streamed decoding may be supported in future versions. Also error handling is somewhat basic, very badly formed CBOR data may trigger exceptions in the decoding process, if you need to protect against this please enclose all decoding operations in try/catch blocks. If you use this package at both ends of your CBOR interchange nodes you will not need to do this.

3.2.0 #

Issue 13

3.1.0 #

Issue 5

3.0.0 #

Issue 10

2.1.0 #

Issue 9

2.0.5 #

Linter rules update

2.0.4 #

Linter rules update

2.0.3 #

Issue 6, linter rules update

2.0.2 #

Issue 4, update to Dart 2

1.0.4 #

Updates for pub. Remove json_mapper

1.0.3 #

Strong mode updates for pub.

1.0.2 #

  • SDK version constraint update

1.0.1 #

  • Minor update to the README, issue 1.

1.0.0 #

  • Initial version


 * Package : Cbor
 * Author : S. Hamblett <steve.hamblett@linux.com>
 * Date   : 19/04/2020
 * Copyright :  S.Hamblett

/// Example file created for pub compatibility only, please refer to the other
/// example files in this directory.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  cbor: ^3.2.0

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:cbor/cbor.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jul 7, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.6.0 <3.0.0
convert ^2.1.1 2.1.1
meta ^1.1.8 1.2.1
typed_data ^1.1.6 1.2.0
Transitive dependencies
charcode 1.1.3
collection 1.14.13
Dev dependencies
build_runner ^1.7.3
build_test ^0.10.12
build_web_compilers ^2.8.0
pana ^0.13.4
pedantic ^1.9.0
test ^1.11.0