fromMap static method

DocumentIdentificationResult fromMap(
  1. dynamic map
)

Implementation

static DocumentIdentificationResult fromMap(dynamic map) {
  var documentType = DocumentIdentificationType.PASSPORT;
  switch (map['documentType']) {
    case 'DL':
      documentType = DocumentIdentificationType.DRIVERS_LICENSE;
      break;
    case 'NID':
      documentType = DocumentIdentificationType.NATIONAL_ID;
      break;
  }
  var result = DocumentIdentificationResult(documentType);
  result.givenNames = map['givenNames'];
  result.surname = map['surname'];
  result.dateOfBirth = map['dateOfBirth'] == null ? null : DateTime.parse(map['dateOfBirth']);
  result.dateOfExpiry = map['dateOfExpiry'] == null ? null : DateTime.parse(map['dateOfExpiry']);
  result.dateOfIssue = map['dateOfIssue'] == null ? null : DateTime.parse(map['dateOfIssue']);
  result.sex = map['sex'];
  result.nationality = map['nationality'];
  result.issuingCountry = map['issuingCountry'];
  result.documentNumber = map['documentNumber'];
  result.address = map['address'];
  result.placeOfBirth = map['placeOfBirth'];
  result.issuingAuthority = map['issuingAuthority'];
  result.personalNumber = map['personalNumber'];
  result.givenNamesLocalized = map['givenNamesLocalized'];
  result.surnameAndGivenNamesLocalized = map['surnameAndGivenNamesLocalized'];
  result.placeOfBirthLocalized = map['placeOfBirthLocalized'];
  result.issuingAuthorityLocalized = map['issuingAuthorityLocalized'];
  result.addressLocalized = map['addressLocalized'];
  result.jurisdiction = map['jurisdiction'];
  result.licenseClass = map['licenseClass'];
  result.licenseClassDetails = map['licenseClassDetails']?.map<String,DriversLicenseClassDetailResult>(
          (k,v) => MapEntry(k as String, DriversLicenseClassDetailResult.fromMap(v))
  );
  result.isSixteenPlus = map['isSixteenPlus'] == true;
  result.isEighteenPlus = map['isEighteenPlus'] == true;
  result.isTwentyOnePlus = map['isTwentyOnePlus'] == true;
  return result;
}