generateAsBase64String static method

String generateAsBase64String(
  1. int length
)

Generates a random salt of length bytes from a cryptographically secure random number generator and encodes it to Base64.

length is the number of bytes generated, not the length of the base64 encoded string returned. Decoding the base64 encoded string will yield length number of bytes.

Implementation

static String generateAsBase64String(int length) {
  var encoder = new Base64Encoder();
  return encoder.convert(generate(length));
}