Uuid.v6 constructor
Uuid.v6({
- int? nodeId,
Generates a v6 (time-based) UUID as defined by RFC 9562.
The implementation behaves exactly like the v1 implementation, just with the timestamp parts reordered so UUIDs are automatically sorted by time.
The default implementation doesn't use a real MAC address as a node ID. Instead it generates a random node ID and sets the "multi-cast bit" as recommended by RFC 4122. A generated node ID will be kept in-memory and reused during the lifetime of a process, but won't be persisted.
Instead of using a generated node ID, you may specify one using nodeId
.
If the given node ID is larger than 48-bit, an ArgumentError is thrown.
Implementation
factory Uuid.v6({int? nodeId}) {
final bytes = Uuid6Generator().generate(nodeId: nodeId);
// We trust our own generator not to modify the bytes anymore.
return Uuid._fromValidBytes(bytes);
}