v5 method

String v5(
  1. String? namespace,
  2. String? name, {
  3. @Deprecated('use config instead. Removal in 5.0.0') Map<String, dynamic>? options,
  4. V5Options? config,
})

Generates a namespace & name-based version 5 UUID

By default it will generate a string based on a provided uuid namespace and name, and will return a string.

The first optional argument is an options map that takes various configuration options detailed in the readme. This is going to be eventually deprecated.

The second optional argument is a V5Options object that takes the same options as the options map. This is the preferred way to pass options.

http://tools.ietf.org/html/rfc4122.html#section-4.4

Example: Generate string UUID with fully-specified options

uuid.v5(Uuid.NAMESPACE_URL, 'www.google.com');
// -> "c74a196f-f19d-5ea9-bffd-a2742432fc9c"

Implementation

String v5(String? namespace, String? name,
    {@Deprecated('use config instead. Removal in 5.0.0')
    Map<String, dynamic>? options,
    V5Options? config}) {
  if (options != null && options.isNotEmpty) {
    V4Options? v4config;
    config = V5Options(options["randomNamespace"], v4config);
  }
  return UuidV5(goptions: goptions)
      .generate(namespace, name, options: config);
}