getSecureRandomHex static method

String getSecureRandomHex(
  1. int length
)

return a secure random hex string of given length

Implementation

static String getSecureRandomHex(int length) {
  final random = Random.secure();
  final values = List<int>.generate(length, (i) => random.nextInt(256));
  return HEX.encode(values);
}