Person.fromJson constructor

Person.fromJson(
  1. Object? json
)

Implementation

factory Person.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return Person(
    account: map['account'] == null ? null : (map['account'] as String),
    additionalTosAcceptances: map['additional_tos_acceptances'] == null
        ? null
        : PersonAdditionalTosAcceptances.fromJson(
            map['additional_tos_acceptances']),
    address: map['address'] == null ? null : Address.fromJson(map['address']),
    addressKana: map['address_kana'] == null
        ? null
        : LegalEntityJapanAddress.fromJson(map['address_kana']),
    addressKanji: map['address_kanji'] == null
        ? null
        : LegalEntityJapanAddress.fromJson(map['address_kanji']),
    created:
        DateTime.fromMillisecondsSinceEpoch((map['created'] as int).toInt()),
    dob: map['dob'] == null ? null : LegalEntityDob.fromJson(map['dob']),
    email: map['email'] == null ? null : (map['email'] as String),
    firstName:
        map['first_name'] == null ? null : (map['first_name'] as String),
    firstNameKana: map['first_name_kana'] == null
        ? null
        : (map['first_name_kana'] as String),
    firstNameKanji: map['first_name_kanji'] == null
        ? null
        : (map['first_name_kanji'] as String),
    fullNameAliases: map['full_name_aliases'] == null
        ? null
        : (map['full_name_aliases'] as List<Object?>)
            .map((el) => (el as String))
            .toList(),
    futureRequirements: map['future_requirements'] == null
        ? null
        : PersonFutureRequirements.fromJson(map['future_requirements']),
    gender: map['gender'] == null ? null : (map['gender'] as String),
    id: (map['id'] as String),
    idNumberProvided: map['id_number_provided'] == null
        ? null
        : (map['id_number_provided'] as bool),
    idNumberSecondaryProvided: map['id_number_secondary_provided'] == null
        ? null
        : (map['id_number_secondary_provided'] as bool),
    lastName: map['last_name'] == null ? null : (map['last_name'] as String),
    lastNameKana: map['last_name_kana'] == null
        ? null
        : (map['last_name_kana'] as String),
    lastNameKanji: map['last_name_kanji'] == null
        ? null
        : (map['last_name_kanji'] as String),
    maidenName:
        map['maiden_name'] == null ? null : (map['maiden_name'] as String),
    metadata: map['metadata'] == null
        ? null
        : (map['metadata'] as Map).cast<String, Object?>().map((
              key,
              value,
            ) =>
                MapEntry(
                  key,
                  (value as String),
                )),
    nationality:
        map['nationality'] == null ? null : (map['nationality'] as String),
    phone: map['phone'] == null ? null : (map['phone'] as String),
    politicalExposure: map['political_exposure'] == null
        ? null
        : PersonPoliticalExposure.fromJson(map['political_exposure']),
    registeredAddress: map['registered_address'] == null
        ? null
        : Address.fromJson(map['registered_address']),
    relationship: map['relationship'] == null
        ? null
        : PersonRelationship.fromJson(map['relationship']),
    requirements: map['requirements'] == null
        ? null
        : PersonFutureRequirements.fromJson(map['requirements']),
    ssnLast4Provided: map['ssn_last_4_provided'] == null
        ? null
        : (map['ssn_last_4_provided'] as bool),
    verification: map['verification'] == null
        ? null
        : LegalEntityPersonVerification.fromJson(map['verification']),
  );
}