v1 method

String v1({
  1. @Deprecated('use config instead. Removal in 5.0.0') Map<String, dynamic>? options,
  2. V1Options? config,
})

Generates a time-based version 1 UUID

By default it will generate a string based off current time, and will return a string.

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

The second argument is a V1Options 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.2.2

Example: Generate string UUID with fully-specified options

uuid.v1(options: {
    'node': [0x01, 0x23, 0x45, 0x67, 0x89, 0xab],
    'clockSeq': 0x1234,
    'mSecs': new DateTime.utc(2011,11,01).millisecondsSinceEpoch,
    'nSecs': 5678
})   // -> "710b962e-041c-11e1-9234-0123456789ab"

Implementation

String v1(
    {@Deprecated('use config instead. Removal in 5.0.0')
    Map<String, dynamic>? options,
    V1Options? config}) {
  if (options != null && options.isNotEmpty) {
    config = V1Options(options["clockSeq"], options["mSecs"],
        options["nSecs"], options["node"], options["seedBytes"]);
  }
  return UuidV1(goptions: goptions).generate(options: config);
}