class UserProfile { const UserProfile({ required this.username, required this.displayName, required this.roleLabel, required this.branchLabel, }); final String username; final String displayName; final String roleLabel; final String branchLabel; String get initials { final parts = displayName .trim() .split(RegExp(r'\s+')) .where((part) => part.isNotEmpty) .toList(growable: false); if (parts.isEmpty) return 'U'; if (parts.length == 1) return parts.first.substring(0, 1).toUpperCase(); return '${parts.first.substring(0, 1)}${parts.last.substring(0, 1)}' .toUpperCase(); } }