randomBytes function

Uint8List randomBytes(
  1. int n
)

Implementation

Uint8List randomBytes(int n) {
  final Random generator = Random.secure();
  final Uint8List random = Uint8List(n);
  for (int i = 0; i < random.length; i++) {
    random[i] = generator.nextInt(255);
  }
  return random;
}