encode method

  1. @override
List<int> encode()
override

Encode the value into CBOR bytes

Implementation

@override
List<int> encode() {
  final bytes = CborBytesTracker();
  bytes.pushInt(MajorTags.array, length ?? value.length);
  for (final v in value) {
    final obj = CborObject.fromDynamic(v);
    final encodeObj = obj.encode();
    bytes.pushBytes(encodeObj);
  }

  return bytes.toBytes();
}