uuid function

String uuid({
  1. bool secure = false,
})

Generates a UUID (v4).

If secure is true, uses a crypto-secure RNG at the cost of worse performance (5-100x, depending on the platform).

Implementation

String uuid({bool secure = false}) => const Uuid().v4(
      options: !secure
          ? null
          // Use the crypto-secure RNG per `package:uuid` docs:
          // https://github.com/Daegalus/dart-uuid/blob/d7bc930942afc752edd0fd15f8bf8234d81dfeda/example/example.dart#L21
          : const <String, Object>{
              'rng': UuidUtil.cryptoRNG,
            },
    );