fromJson static method

LeadPersonalInformation? fromJson(
  1. dynamic value
)

Returns a new LeadPersonalInformation instance and imports its values from value if it's a Map, null otherwise.

Implementation

// ignore: prefer_constructors_over_static_methods
static LeadPersonalInformation? fromJson(dynamic value) {
  if (value is Map) {
    final json = value.cast<String, dynamic>();

    // Ensure that the map contains the required keys.
    // Note 1: the values aren't checked for validity beyond being non-null.
    // Note 2: this code is stripped in release mode!
    assert(() {
      return true;
    }());

    return LeadPersonalInformation(
      firstName: mapValueOfType<String>(json, r'firstName'),
      lastName: mapValueOfType<String>(json, r'lastName'),
      aliasFirstName: mapValueOfType<String>(json, r'aliasFirstName'),
      aliasLastName: mapValueOfType<String>(json, r'aliasLastName'),
      email: mapValueOfType<String>(json, r'email'),
      city: mapValueOfType<String>(json, r'city'),
      state: State.fromJson(json[r'state']),
      workPhone: mapValueOfType<String>(json, r'workPhone'),
      primaryPhone: mapValueOfType<String>(json, r'primaryPhone'),
      bestTimeToCall: LeadBestTimeToCall.fromJson(json[r'bestTimeToCall']),
      address1: mapValueOfType<String>(json, r'address1'),
      address2: mapValueOfType<String>(json, r'address2'),
      addressMoveInDate: mapDateTime(json, r'addressMoveInDate', r''),
      zipcode: mapValueOfType<String>(json, r'zipcode'),
      monthsAtAddress: mapValueOfType<int>(json, r'monthsAtAddress'),
      driversLicenseNumber:
          mapValueOfType<String>(json, r'driversLicenseNumber'),
      driversLicenseState:
          mapValueOfType<String>(json, r'driversLicenseState'),
      ipAddress: mapValueOfType<String>(json, r'ipAddress'),
      activeMilitary: mapValueOfType<bool>(json, r'activeMilitary'),
      militaryVeteran: mapValueOfType<bool>(json, r'militaryVeteran'),
      dateOfBirth: mapDateTime(json, r'dateOfBirth', r''),
      educationLevel: EducationLevel.fromJson(json[r'educationLevel']),
      ssn: mapValueOfType<String>(json, r'ssn'),
      citizenshipStatus:
          CitizenshipStatus.fromJson(json[r'citizenshipStatus']),
      maritalStatus: MaritalStatus.fromJson(json[r'maritalStatus']),
    );
  }
  return null;
}