Uuid.v4 constructor

Uuid.v4({
  1. Random? random,
})

Generates a v4 (random) UUID.

If you don't pass a random number generator for the random parameter, a global secure one will be used.

Implementation

factory Uuid.v4({Random? random}) {
  final bytes = Uuid4Generator(random).generate();
  // We trust our own generator not to modify the bytes anymore.
  return Uuid._fromValidBytes(bytes);
}