getUserInitials function

String getUserInitials(
  1. User user
)

Returns user initials (can have only first letter of firstName/lastName or both).

Implementation

String getUserInitials(types.User user) {
  var initials = '';

  if ((user.name ?? '').isNotEmpty) {
    initials += user.name![0].toUpperCase();
  }

  return initials.trim();
}