UnitInterval.deserialize constructor
UnitInterval.deserialize(
- CborTagValue cbor
Implementation
factory UnitInterval.deserialize(CborTagValue cbor) {
if (!BytesUtils.bytesEqual(cbor.tags, _cborTag)) {
throw ADAPluginException("Invalid UnitInterval cbor tag.",
details: {"Excepted": _cborTag, "Tag": cbor.tags});
}
final cborList = cbor.getValue<CborListValue>();
return UnitInterval(
numerator: cborList.getIndex<CborObject>(0).getInteger(),
denominator: cborList.getIndex<CborObject>(1).getInteger());
}