SearchResult.fromJson constructor

SearchResult.fromJson(
  1. Map<String, Object?> json
)

Implementation

factory SearchResult.fromJson(Map<String, Object?> json) {
  return SearchResult(
    content: json[r'content'] != null
        ? Content.fromJson(json[r'content']! as Map<String, Object?>)
        : null,
    user: json[r'user'] != null
        ? User.fromJson(json[r'user']! as Map<String, Object?>)
        : null,
    space: json[r'space'] != null
        ? Space.fromJson(json[r'space']! as Map<String, Object?>)
        : null,
    title: json[r'title'] as String? ?? '',
    excerpt: json[r'excerpt'] as String? ?? '',
    url: json[r'url'] as String? ?? '',
    resultParentContainer: json[r'resultParentContainer'] != null
        ? ContainerSummary.fromJson(
            json[r'resultParentContainer']! as Map<String, Object?>)
        : null,
    resultGlobalContainer: json[r'resultGlobalContainer'] != null
        ? ContainerSummary.fromJson(
            json[r'resultGlobalContainer']! as Map<String, Object?>)
        : null,
    breadcrumbs: (json[r'breadcrumbs'] as List<Object?>?)
            ?.map((i) =>
                Breadcrumb.fromJson(i as Map<String, Object?>? ?? const {}))
            .toList() ??
        [],
    entityType: json[r'entityType'] as String? ?? '',
    iconCssClass: json[r'iconCssClass'] as String? ?? '',
    lastModified: DateTime.tryParse(json[r'lastModified'] as String? ?? '') ??
        DateTime(0),
    friendlyLastModified: json[r'friendlyLastModified'] as String?,
    score: json[r'score'] as num?,
  );
}