variant property

UuidVariant get variant

The UUID variant which determines the layout of the UUID.

Note that only the UuidVariant.rfc4122 variant is properly represented by this class. Other variants are treated as if they were RFC 4122 UUIDs.

Implementation

UuidVariant get variant {
  final variantBits = clockSequenceHighAndReserved >> 5;
  if (variantBits < 4) {
    return UuidVariant.ncsReserved;
  } else if (variantBits == 7) {
    return UuidVariant.futureReserved;
  } else if (variantBits == 6) {
    return UuidVariant.microsoftReserved;
  } else {
    return UuidVariant.rfc4122;
  }
}