fromJson static method

LeadCreateData? fromJson(
  1. dynamic value
)

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

Implementation

// ignore: prefer_constructors_over_static_methods
static LeadCreateData? 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 LeadCreateData(
      productTypes: ProductType.listFromJson(json[r'productTypes']),
      uuid: mapValueOfType<String>(json, r'uuid'),
      sessionUuid: mapValueOfType<String>(json, r'sessionUuid'),
      deviceId: mapValueOfType<String>(json, r'deviceId'),
      loanInformation:
          LeadLoanInformationJson.fromJson(json[r'loanInformation']),
      personalInformation:
          LeadPersonalInformation.fromJson(json[r'personalInformation']),
      personalReferenceInformation:
          LeadPersonalReferenceInformationJson.fromJson(
              json[r'personalReferenceInformation']),
      mortgageInformation:
          LeadMortgageInformationJson.fromJson(json[r'mortgageInformation']),
      creditCardInformation: LeadCreditCardInformationJson.fromJson(
          json[r'creditCardInformation']),
      savingsInformation:
          LeadSavingsInformationJson.fromJson(json[r'savingsInformation']),
      creditInformation:
          LeadCreditInformationJson.fromJson(json[r'creditInformation']),
      financialInformation:
          LeadFinancialInformation.fromJson(json[r'financialInformation']),
      employmentInformation: LeadEmploymentInformationJson.fromJson(
          json[r'employmentInformation']),
      legalInformation:
          LeadLegalInformationJson.fromJson(json[r'legalInformation']),
      educationInformation: LeadEducationInformationJson.fromJson(
          json[r'educationInformation']),
      coApplicantInformation: LeadCoApplicantInformationJson.fromJson(
          json[r'coApplicantInformation']),
      healthInformation:
          LeadHealthInformationJson.fromJson(json[r'healthInformation']),
      autoInsuranceInformation: LeadAutoInsuranceInformationJson.fromJson(
          json[r'autoInsuranceInformation']),
      refinanceLoans: LeadRefinanceLoanInformationJson.listFromJson(
          json[r'refinanceLoans']),
      identificationInformation: LeadIdentificationInformationJson.fromJson(
          json[r'identificationInformation']),
      clientTags: json[r'clientTags'] == null
          ? const {}
          : (json[r'clientTags'] as Map<String, dynamic>).map((k, v) =>
              MapEntry(
                  k,
                  v == null
                      ? const <String>[]
                      : (v as List)
                          .map((value) => value as String)
                          .toList(growable: false))),
      sessionInformation:
          LeadSessionInformationJson.fromJson(json[r'sessionInformation']),
      formCompleted: mapValueOfType<bool>(json, r'formCompleted'),
      referralCompanyUuid:
          mapValueOfType<String>(json, r'referralCompanyUuid'),
      trackingUuid: mapValueOfType<String>(json, r'trackingUuid'),
      partnerUserId: mapValueOfType<String>(json, r'partnerUserId'),
    );
  }
  return null;
}