getLastName static method

String? getLastName(
  1. Map<String, dynamic> json
)

Implementation

static String? getLastName(Map<String, dynamic> json) {
  String? lastName = json['lastName'];
  if (lastName == null) {
    lastName = json['displayName'];
    if (lastName != null) {
      if (json['firstName'] == null) {
        lastName = lastName.replaceAll(RegExp(r'\s+'), ' ').trim();
      } else {
        lastName = lastName
            .replaceAll(RegExp(r'\b' + json['firstName'] + r'\b'), '')
            .replaceAll(RegExp(r'\s+'), ' ')
            .trim();
      }
    }
  }
  return lastName;
}