fromJson static method

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

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

Implementation

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

  DateTime? createdAt =
      json[r'createdAt'] == null ? null : DateTime.parse(json[r'createdAt']);
  if (createdAt != null && createdAt.isUtc == false) {
    createdAt = DateTime.parse('${json[r'createdAt']}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');
  }

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

  return Organization(
    links: OrganizationLinks.fromJson(json[r'_links']),
    address: OrganizationPostalAddress.fromJson(json[r'address']),
    alternateName: json[r'alternateName'],
    archived: json[r'archived'],
    createdAt: createdAt,
    description: json[r'description'],
    enabled: json[r'enabled'],
    endDate: endDate,
    id: json[r'id'],
    name: json[r'name'],
    preferences: OrganizationPreferences.fromJson(json[r'preferences']),
    startDate: startDate,
    type: json[r'type'],
    updatedAt: updatedAt,
  );
}