Comment class

Annotations
  • @freezed

Constructors

Comment.new({@JsonKey(name: 'id', required: true) required String id, @JsonKey(name: 'user', required: true) required UserSimple user, @JsonKey(name: 'createdBy', required: true) required String createdBy, @JsonKey(name: 'content', required: true) required String content, @JsonKey(name: 'upvotes') @Default(0) int upvotes, @JsonKey(name: 'downvotes') @Default(0) int downvotes, @JsonKey(name: 'upvoted') @Default(false) bool upvoted, @JsonKey(name: 'downvoted') @Default(false) bool downvoted, @JsonKey(name: 'replies') required List<Comment> replies, @JsonKey(name: 'pinned') @Default(false) bool pinned, @JsonKey(name: 'isPrivate') @Default(false) bool isPrivate, @JsonKey(name: 'createdAt', required: true) required DateTime createdAt})
const
factory
Comment.fromJson(Map<String, Object?> json)
factory

Properties

content String
The content of the comment
no setterinherited
copyWith → $CommentCopyWith<Comment>
Create a copy of Comment with the given fields replaced by the non-null parameter values.
no setterinherited
createdAt DateTime
The date the comment was created
no setterinherited
createdBy String
The id of the user who created the comment
no setterinherited
downvoted bool
Whether the user has downvoted the comment
no setterinherited
downvotes int
The amount of downvotes the comment has
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
id String
The comment id
no setterinherited
isPrivate bool
Whether the comment is private
no setterinherited
pinned bool
Whether the comment is pinned
no setterinherited
replies List<Comment>
The replies to the comment
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
upvoted bool
Whether the user has upvoted the comment
no setterinherited
upvotes int
The amount of upvotes the comment has
no setterinherited
user UserSimple
The user who created the comment
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Serializes this Comment to a JSON map.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited