fromJson static method

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

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

Implementation

static Feedback? 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? 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 Feedback(
    embedded: FeedbackEmbedded.fromJson(json[r'_embedded']),
    links: FeedbackLinks.fromJson(json[r'_links']),
    createdAt: createdAt,
    description: json[r'description'],
    geoCoordinates: FeedbackGeoCoordinates.fromJson(json[r'geoCoordinates']),
    id: json[r'id'],
    metadata: json[r'metadata'] == null
        ? null
        : Map<String, Object>.from(json[r'metadata']),
    public: json[r'public'],
    type: json[r'type'],
    updatedAt: updatedAt,
    visibility: FeedbackVisibilityEnum.fromJson(json[r'visibility']),
  );
}