getSecureRandomString static method

String getSecureRandomString(
  1. int length
)

return a secure random string of given length

Implementation

static String getSecureRandomString(int length) {
  final random = Random.secure();
  final values = List<int>.generate(length, (i) => random.nextInt(256));
  return base64UrlEncode(values);
}