computeDisplayName function
Combines mapped firstName/lastName into a display name, falling back to username then id.
Implementation
String computeDisplayName(
Map<String, List<String>> mappings,
model.UserProfile profile,
) {
final fullName = [
mapAttribute('firstName', mappings, profile),
mapAttribute('lastName', mappings, profile),
].whereType<String>().join(' ').trim();
if (fullName.isNotEmpty) return fullName;
return mapAttribute('username', mappings, profile) ?? profile.id;
}