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.firstName ?? '').isNotEmpty) {
    initials += user.firstName![0].toUpperCase();
  }

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

  return initials.trim();
}