Post class

Annotations
  • @freezed

Constructors

Post.new({@JsonKey(name: 'id', required: true) required String id, @JsonKey(name: 'slug', required: true) required String slug, @JsonKey(name: 'title', required: true) required String title, @JsonKey(name: 'content', required: true) required String content, @JsonKey(name: 'user', required: true) required UserSimple user, @JsonKey(name: 'postStatus', required: true) required PostStatus status, @JsonKey(name: 'upvotes', defaultValue: 0) @Default(0) int upvotes, @JsonKey(name: 'commentCount', defaultValue: 0) @Default(0) int commentCount, @JsonKey(name: 'upvoted', defaultValue: false) @Default(false) bool upvoted, @JsonKey(name: 'downvoted', defaultValue: false) @Default(false) bool downvoted, @JsonKey(name: 'pinned', defaultValue: false) @Default(false) bool pinned, @JsonKey(name: 'isSubscribed', defaultValue: false) @Default(false) bool isSubscribed, @JsonKey(name: 'date', required: true) required DateTime date, @JsonKey(name: 'lastModified', required: true) required DateTime lastModified, @JsonKey(name: 'postCategory', required: true) required PostCategory postCategory})
const
factory
Post.fromJson(Map<String, Object?> json)
factory

Properties

commentCount int
Post comment count
no setterinherited
content String
The content of the post
no setterinherited
copyWith → $PostCopyWith<Post>
Create a copy of Post with the given fields replaced by the non-null parameter values.
no setterinherited
date DateTime
Date the post was created
no setterinherited
downvoted bool
Whether the user has downvoted the post (false by default)
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
id String
The id of the post
no setterinherited
isSubscribed bool
Whether the user is subscribed to the post (false by default)
no setterinherited
lastModified DateTime
Date the post was last updated
no setterinherited
pinned bool
Whether the post is pinned (false by default)
no setterinherited
postCategory PostCategory
The category of the post
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
slug String
The slug of the post
no setterinherited
status PostStatus
The status of the post
no setterinherited
title String
The title of the post
no setterinherited
upvoted bool
Whether the user has upvoted the post (false by default)
no setterinherited
upvotes int
Post upvotes
no setterinherited
user UserSimple
The user who created the post
no setterinherited

Methods

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

Operators

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