fromJson static method

OrganizationPatch? fromJson(
  1. Map<String, dynamic>? json
)

Returns a new OrganizationPatch instance and imports its values from json if it's non-null, null if json is null.

Implementation

static OrganizationPatch? fromJson(Map<String, dynamic>? json) {
  if (json == null) {
    return null;
  }

  DateTime? archivedAt = json[r'archivedAt'] == null
      ? null
      : DateTime.parse(json[r'archivedAt']);
  if (archivedAt != null && archivedAt.isUtc == false) {
    archivedAt = DateTime.parse('${json[r'archivedAt']}Z');
  }

  DateTime? endDate =
      json[r'endDate'] == null ? null : DateTime.parse(json[r'endDate']);
  if (endDate != null && endDate.isUtc == false) {
    endDate = DateTime.parse('${json[r'endDate']}Z');
  }

  DateTime? startDate =
      json[r'startDate'] == null ? null : DateTime.parse(json[r'startDate']);
  if (startDate != null && startDate.isUtc == false) {
    startDate = DateTime.parse('${json[r'startDate']}Z');
  }

  return OrganizationPatch(
    address: ExternalServicePatchAddress.fromJson(json[r'address']),
    alternateName: json[r'alternateName'],
    archivedAt: archivedAt,
    description: json[r'description'],
    endDate: endDate,
    logo: json[r'logo'],
    name: json[r'name'],
    preferences: OrganizationPatchPreferences.fromJson(json[r'preferences']),
    startDate: startDate,
  );
}