Comment.fromJson constructor
Comment.fromJson(
- Map<String, dynamic> json
)
Implementation
factory Comment.fromJson(Map<String, dynamic> json) {
return Comment(
id: _requiredString(json, 'id'),
postId: _requiredString(json, 'postId'),
ownerId: _requiredString(json, 'ownerId'),
parentCommentId: _optionalString(json, 'parentCommentId'),
text: _requiredString(json, 'text'),
createdAt: _requiredDateTime(json, 'createdAt'),
updatedAt: _optionalDateTime(json, 'updatedAt'),
isDeleted: _optionalBool(json, 'isDeleted') ?? false,
reactionCount: _optionalInt(json, 'reactionCount') ?? 0,
myReaction: _optionalString(json, 'myReaction'),
);
}