v4obj method

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

Generates a RNG version 4 UUID as a UuidValue object

By default it will generate a string based cryptoRNG, and will return a UuidValue object. If you wish to use crypto-strong RNG, pass in UuidUtil.cryptoRNG

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 V4Options 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: UuidValue usage

uuidValue = uuid.v4obj(options: {
  'random': [
    0x10, 0x91, 0x56, 0xbe, 0xc4, 0xfb, 0xc1, 0xea,
    0x71, 0xb4, 0xef, 0xe1, 0x67, 0x1c, 0x58, 0x36
  ]
}) // -> UuidValue{uuid: '109156be-c4fb-41ea-b1b4-efe1671c5836'}

print(uuidValue) -> // -> '109156be-c4fb-41ea-b1b4-efe1671c5836'
uuidValue.toBytes() -> // -> [...]

Implementation

UuidValue v4obj(
    {@Deprecated('use config instead. Removal in 5.0.0')
    Map<String, dynamic>? options,
    V4Options? config}) {
  return options != null
      ? UuidValue.fromString(v4(options: options))
      : UuidValue.fromString(v4(config: config));
}