toInitial property

String get toInitial

Implementation

String get toInitial {
  if ((this ?? '').isNotEmpty) {
    final splt = (this ?? '').split(" ");
    splt.removeWhere((element) => element.isEmpty);
    if (splt.length > 1) {
      return "${splt.first[0]}${splt.last[0]}".toUpperCase();
    }
    if (splt.first.length > 1) {
      return "${splt.first[0]}${splt.first[1]}".toUpperCase();
    } else {
      return splt.first[0].toUpperCase();
    }
  } else {
    return "";
  }
}