randomBytes static method

Uint8List randomBytes(
  1. int length
)

Implementation

static Uint8List randomBytes(int length) {
  Uint8List buffer = Uint8List(length);
  Random range = Random.secure();

  for (int i = 0; i < length; i++) {
    buffer[i] = range.nextInt(256);
  }

  return buffer;
}