fromJson static method

IdentityDocumentInput? fromJson(
  1. dynamic value
)

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

Implementation

// ignore: prefer_constructors_over_static_methods
static IdentityDocumentInput? 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(() {
      assert(json.containsKey(r'type'), 'Required key "IdentityDocumentInput[type]" is missing from JSON.');
      assert(json[r'type'] != null, 'Required key "IdentityDocumentInput[type]" has a null value in JSON.');
      assert(json.containsKey(r'uniqueIdentifier'), 'Required key "IdentityDocumentInput[uniqueIdentifier]" is missing from JSON.');
      assert(json[r'uniqueIdentifier'] != null, 'Required key "IdentityDocumentInput[uniqueIdentifier]" has a null value in JSON.');
      assert(json.containsKey(r'issuingCountryCode'), 'Required key "IdentityDocumentInput[issuingCountryCode]" is missing from JSON.');
      assert(json[r'issuingCountryCode'] != null, 'Required key "IdentityDocumentInput[issuingCountryCode]" has a null value in JSON.');
      assert(json.containsKey(r'expiresOn'), 'Required key "IdentityDocumentInput[expiresOn]" is missing from JSON.');
      assert(json[r'expiresOn'] != null, 'Required key "IdentityDocumentInput[expiresOn]" has a null value in JSON.');
      return true;
    }());

    return IdentityDocumentInput(
      type: IdentityDocumentInputTypeEnum.fromJson(json[r'type'])!,
      uniqueIdentifier: mapValueOfType<String>(json, r'uniqueIdentifier')!,
      issuingCountryCode: mapValueOfType<String>(json, r'issuingCountryCode')!,
      expiresOn: mapDateTime(json, r'expiresOn', r'')!,
    );
  }
  return null;
}