randomBytes static method

Uint8List randomBytes(
  1. int length
)

Implementation

static Uint8List randomBytes(int length) {
  final random = Random.secure();
  final Uint8List bytes = Uint8List(length);
  for (var i = 0; i < length; i++) {
    bytes[i] = random.nextInt(256);
  }
  return bytes;
}