randomIsSecure property Null safety
Indicates if a cryptographically secure random number generator is available.
True if a cryptographically secure random number generator is available for generating random salts, otherwise false.
When the value is false, attempts to generate a random salt (i.e. when no salt value is provided to Crypt.sha256 or Crypt.sha512) and attempts to set cryptographicallySecureSalts to true will throw an UnsupportedError exception.
Which random number generator is used is controlled by cryptographicallySecureSalts.
Implementation
static bool get randomIsSecure {
if (_random == null) {
try {
_setRandomNumberGeneratorForSalt();
} on UnsupportedError {
return false; // could not create cryptographic secure
}
}
return _randomIsSecure!;
}