getInitials static method
Implementation
static String getInitials(String? fullName) {
// Return "U" if the full name is null
if (fullName == null || fullName.isEmpty) return "U";
// Split the full name by spaces
List<String> nameParts = fullName.split(" ");
// Filter out empty parts, get the first letter of each part, capitalize it, and join without spaces
return nameParts
.where((part) => part.isNotEmpty)
.map((part) => part[0].toUpperCase())
.join();
}