getFirstLetterFromName method

String getFirstLetterFromName(
  1. String? first,
  2. String? middle,
  3. String? last
)

Implementation

String getFirstLetterFromName(String? first, String? middle, String? last) {
  String nameLetters = "";
  if (first != null) {
    nameLetters = first[0].toUpperCase();
  }
  if (first != null && last != null) {
    nameLetters = nameLetters + last[0].toUpperCase();
  }
  if (last == null && middle != null) {
    nameLetters = middle[0].toUpperCase();
  }
  return nameLetters;
}