generate static method

String generate()

Implementation

static String generate() {
  Random rnd = Random();
  const letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
  const allowedChars = '0123456789' + letters;
  const numberOfCodePoints = allowedChars.length;
  const codeSize = 11;
  String uid;
  int charIndex = (rnd.nextInt(10) / 10 * letters.length).round();
  uid = letters.substring(charIndex, charIndex + 1);
  for (int i = 1; i < codeSize; ++i) {
    charIndex = (rnd.nextInt(10) / 10 * numberOfCodePoints).round();
    uid += allowedChars.substring(charIndex, charIndex + 1);
  }
  return uid;
}