cborPrettyPrint function

String cborPrettyPrint(
  1. List<int> input, {
  2. int indent = 2,
})

Pretty print a CBOR input.

Example output with indent = 2 for {1: "one", 2: "two"}:

a2 (map length 2)
  1 (int 1)
  63 6f 6e 65 (string "one")
  2 (int 2)
  63 74 77 6f (string "two")

Implementation

String cborPrettyPrint(
  List<int> input, {
  int indent = 2,
}) {
  final prettyPrint = _PrettyPrint(input, indent: indent);
  RawSink(prettyPrint)
    ..add(input)
    ..close();

  return prettyPrint.writer.toString();
}