Uuid constructor

Uuid(
  1. int l,
  2. int m,
  3. int h,
  4. int s,
  5. int n,
)

Creates a UUID from the provided 5 sets of octets.

llllllll-mmmm-hhhh-ssss-nnnnnnnnnnnn

If any provided integer is out of range, an error will be thrown:

  • l: unsigned 32-bits
  • m: unsigned 16-bits
  • h: unsigned 16-bits
  • s: unsigned 16-bits
  • n: unsigned 48-bits

This is intended to be a convenience constructor instead Uuid.parse :

// These UUIDs represent the same value.
Uuid.parse('123e4567-e89b-12d3-a456-426655440000')
Uuid(0x123e4567, 0xe89b, 0x12d3, 0xa456, 0x426655440000)

Implementation

factory Uuid(int l, int m, int h, int s, int n) {
  return _Uuid(
    RangeError.checkValueInInterval(l, 0x000000000000, 0x0000ffffffff),
    RangeError.checkValueInInterval(m, 0x000000000000, 0x00000000ffff),
    RangeError.checkValueInInterval(h, 0x000000000000, 0x00000000ffff),
    RangeError.checkValueInInterval(s, 0x000000000000, 0x00000000ffff),
    RangeError.checkValueInInterval(n, 0x000000000000, 0xffffffffffff),
  );
}