randomSecretCode function

String randomSecretCode(
  1. int len, {
  2. bool isNum = false,
})

Implementation

String randomSecretCode(int len, {bool isNum = false}) {
  final r = Random.secure();
  final String chars;
  if (isNum) {
    chars = '0123456789';
  } else {
    chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
  }
  return List.generate(len, (index) => chars[r.nextInt(chars.length)]).join();
}