Comment.fromJson constructor

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

Implementation

factory Comment.fromJson(Map<String, Object?> json) {
  return Comment(
    author: json[r'author'] != null
        ? UserDetails.fromJson(json[r'author']! as Map<String, Object?>)
        : null,
    body: json[r'body'],
    created: DateTime.tryParse(json[r'created'] as String? ?? ''),
    id: json[r'id'] as String?,
    jsdAuthorCanSeeRequest: json[r'jsdAuthorCanSeeRequest'] as bool? ?? false,
    jsdPublic: json[r'jsdPublic'] as bool? ?? false,
    properties: (json[r'properties'] as List<Object?>?)
            ?.map((i) => EntityProperty.fromJson(
                i as Map<String, Object?>? ?? const {}))
            .toList() ??
        [],
    renderedBody: json[r'renderedBody'] as String?,
    self: json[r'self'] as String?,
    updateAuthor: json[r'updateAuthor'] != null
        ? UserDetails.fromJson(json[r'updateAuthor']! as Map<String, Object?>)
        : null,
    updated: DateTime.tryParse(json[r'updated'] as String? ?? ''),
    visibility: json[r'visibility'] != null
        ? Visibility.fromJson(json[r'visibility']! as Map<String, Object?>)
        : null,
  );
}