cborDecode<T> function

T cborDecode<T>(
  1. List<int> value
)

Implementation

T cborDecode<T>(List<int> value) {
  final buffer = value is Uint8Buffer ? value : Uint8Buffer()
    ..addAll(value);
  final cbor.Input input = cbor.Input(buffer);
  final cbor.Listener listener = cbor.ListenerStack();
  final decodeStack = cbor.DecodeStack();
  listener.itemStack.clear();
  final cbor.Decoder decoder = cbor.Decoder.withListener(input, listener);
  decoder.run();
  decodeStack.build(listener.itemStack);
  final walked = decodeStack.walk();
  return walked![0] as T;
}