UnitInterval.deserialize constructor

UnitInterval.deserialize(
  1. CborTagValue cbor
)

Implementation

factory UnitInterval.deserialize(CborTagValue cbor) {
  if (!BytesUtils.bytesEqual(cbor.tags, _cborTag)) {
    throw MessageException("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());
}