decryptLetter function

String decryptLetter(
  1. int factor,
  2. int encryptedLetter
)

This function gets the letter from a position in the alphabet.

Implementation

String decryptLetter(int factor, int encryptedLetter) {
  List<String> myList = [
    'A',
    'B',
    'C',
    'D',
    'E',
    'F',
    'G',
    'H',
    'I',
    'J',
    'K',
    'L',
    'M',
    'N',
    'O',
    'P',
    'Q',
    'R',
    'S',
    'T',
    'U',
    'V',
    'W',
    'X',
    'Y',
    'Z'
  ];
  String result = '';
  for (var i = 0; i < myList.length; i++) {
    int origIndex = (encryptedLetter / factor).round() - 1;
    if (i == origIndex) {
      result = myList[i].toString();
      break;
    } else {}
  }
  return result;
}