decode<T extends CborObject<Object?> > static method
T
decode<T extends CborObject<Object?> >({})
Implementation
static T decode<T extends CborObject>({
List<int>? cborBytes,
CborObject? object,
String? hex,
}) {
try {
if (object == null) {
cborBytes ??= BytesUtils.tryFromHexString(hex);
if (cborBytes != null) {
object = CborObject.fromCbor(cborBytes);
}
}
if (object is T) {
return object;
}
} catch (_) {}
throw CborSerializationException(
"Failed to deserialize CBOR object to $T.",
);
}