CborUnsignedValue.u64 constructor

CborUnsignedValue.u64(
  1. dynamic value
)

Implementation

factory CborUnsignedValue.u64(dynamic value) {
  if (value is! int && value is! BigInt) {
    throw MessageException(
        "Invalid unsgined int. value must be int or bigint.",
        details: {"value": value});
  }
  final BigInt bigintVal = value is int ? BigInt.from(value) : value;
  if (bigintVal.isNegative || bigintVal.bitLength > 64) {
    throw MessageException("Invalid unsigned 64-bit Integer.",
        details: {"Value": bigintVal, "bitLength": bigintVal.bitLength});
  }
  return CborUnsignedValue._(bigintVal);
}