desrialize<T extends CborObject> static method
Deserialize the provided CBOR bytes cborBytes
into an object of type T
.
Throws a MessageException with a descriptive message if deserialization fails.
Implementation
static T desrialize<T extends CborObject>(List<int> cborBytes) {
final decode = CborObject.fromCbor(cborBytes);
if (decode is! T) {
throw MessageException("Failed to deserialize CBOR bytes into type.",
details: {"type": "$T", "Excepted": decode.runtimeType});
}
return decode;
}