fromJson static method

HealthcareProfessional? fromJson(
  1. dynamic value
)

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

Implementation

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

    return HealthcareProfessional(
      id: mapValueOfType<String>(json, r'id'),
      rev: mapValueOfType<String>(json, r'rev'),
      created: mapValueOfType<int>(json, r'created'),
      modified: mapValueOfType<int>(json, r'modified'),
      deletionDate: mapValueOfType<int>(json, r'deletionDate'),
      name: mapValueOfType<String>(json, r'name'),
      lastName: mapValueOfType<String>(json, r'lastName'),
      firstName: mapValueOfType<String>(json, r'firstName'),
      names: PersonName.listFromJson(json[r'names'])!,
      gender: HealthcareProfessionalGenderEnum.fromJson(json[r'gender']),
      civility: mapValueOfType<String>(json, r'civility'),
      speciality: mapValueOfType<String>(json, r'speciality'),
      parentId: mapValueOfType<String>(json, r'parentId'),
      addresses: Address.listFromJson(json[r'addresses'])!,
      languages: json[r'languages'] is List ? (json[r'languages'] as List).cast<String>() : const [],
      picture: mapValueOfType<String>(json, r'picture'),
      specialityCodes: CodingReference.listFromJson(json[r'specialityCodes'])!.toSet(),
      notes: mapValueOfType<String>(json, r'notes'),
      properties: Property.listFromJson(json[r'properties'])!.toSet(),
      systemMetaData: SystemMetaDataOwner.fromJson(json[r'systemMetaData']),
    );
  }
  return null;
}