generateAsBase64String function Null safety
- 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
String generateAsBase64String(int length) {
const encoder = Base64Encoder();
return encoder.convert(generate(length));
}