QueryResultItem.fromJson constructor

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

Implementation

factory QueryResultItem.fromJson(Map<String, dynamic> json) {
  return QueryResultItem(
    additionalAttributes: (json['AdditionalAttributes'] as List?)
        ?.whereNotNull()
        .map((e) =>
            AdditionalResultAttribute.fromJson(e as Map<String, dynamic>))
        .toList(),
    documentAttributes: (json['DocumentAttributes'] as List?)
        ?.whereNotNull()
        .map((e) => DocumentAttribute.fromJson(e as Map<String, dynamic>))
        .toList(),
    documentExcerpt: json['DocumentExcerpt'] != null
        ? TextWithHighlights.fromJson(
            json['DocumentExcerpt'] as Map<String, dynamic>)
        : null,
    documentId: json['DocumentId'] as String?,
    documentTitle: json['DocumentTitle'] != null
        ? TextWithHighlights.fromJson(
            json['DocumentTitle'] as Map<String, dynamic>)
        : null,
    documentURI: json['DocumentURI'] as String?,
    feedbackToken: json['FeedbackToken'] as String?,
    id: json['Id'] as String?,
    scoreAttributes: json['ScoreAttributes'] != null
        ? ScoreAttributes.fromJson(
            json['ScoreAttributes'] as Map<String, dynamic>)
        : null,
    type: (json['Type'] as String?)?.toQueryResultType(),
  );
}