Uuid.fromBits constructor

Uuid.fromBits(
  1. int mostSigBits,
  2. int leastSigBits
)

Creates a UUID from its most and least significant bits.

Parameters:

  • mostSigBits: The most significant 64 bits of the UUID
  • leastSigBits: The least significant 64 bits of the UUID

This constructor allows direct creation of UUIDs from their bit representation, useful for deserialization or when working with UUID storage formats that preserve the raw bits.

Example

final uuid = Uuid.fromBits(0x550e8400e29b41d4, 0xa716446655440000);
print(uuid); // "550e8400-e29b-41d4-a716-446655440000"

Implementation

factory Uuid.fromBits(int mostSigBits, int leastSigBits) {
  return Uuid._(BigInteger.fromInt(mostSigBits), BigInteger.fromInt(leastSigBits));
}