generate static method

Uint8List generate({
  1. Random? random,
})

A fresh key. Uses Random.secure unless a source is supplied, which only tests should do.

Implementation

static Uint8List generate({Random? random}) {
  final source = random ?? Random.secure();
  final key = Uint8List(lengthBytes);
  for (var i = 0; i < lengthBytes; i++) {
    key[i] = source.nextInt(256);
  }
  return key;
}