Uuid.v5 constructor

Uuid.v5({
  1. required Uuid namespace,
  2. required String name,
})

Generates a v5 (name-based with SHA-1) UUID.

Expects a namespace UUID. Some predefined namespace UUIDs can be found in Namespaces. The name should conform to the conventions of the namespace.

Implementation

factory Uuid.v5({required Uuid namespace, required String name}) {
  final bytes = Uuid5Generator().generate(namespace: namespace, name: name);
  // We trust our own generator not to modify the bytes anymore.
  return Uuid._fromValidBytes(bytes);
}