Post constructor

const Post({
  1. required int id,
  2. required String title,
  3. @JsonKey.new(name: 'ap_id') required String apId,
  4. required bool local,
  5. required bool nsfw,
  6. required bool deleted,
  7. required bool removed,
  8. @JsonKey.new(name: 'user_id') required int userId,
  9. @JsonKey.new(name: 'community_id') required int communityId,
  10. @JsonKey.new(name: 'language_id') int? languageId,
  11. String? body,
  12. String? url,
  13. @JsonKey.new(name: 'small_thumbnail_url') String? smallThumbnailUrl,
  14. @JsonKey.new(name: 'thumbnail_url') String? thumbnailUrl,
  15. @JsonKey.new(name: 'alt_text') String? altText,
  16. @JsonKey.new(name: 'image_details') WidthHeight? imageDetails,
  17. @JsonKey.new(name: 'published') required DateTime published,
  18. DateTime? updated,
  19. @JsonKey.new(name: 'ai_generated', defaultValue: false) required bool aiGenerated,
  20. bool? sticky,
  21. @JsonKey.new(name: 'instance_sticky') bool? instanceSticky,
  22. bool? locked,
  23. @JsonKey.new(name: 'post_type') PostType? postType,
  24. PostPoll? poll,
  25. PostEvent? event,
  26. @JsonKey.new(name: 'emoji_reactions') List<Reactions>? emojiReactions,
  27. @JsonKey.new(name: 'cross_posts') List<MiniCrossPosts>? crossPosts,
  28. String? tags,
  29. String? flair,
})

Implementation

const factory Post({
  required int id,
  required String title,
  @JsonKey(name: 'ap_id') required String apId,
  required bool local,
  required bool nsfw,
  required bool deleted,
  required bool removed,
  @JsonKey(name: 'user_id') required int userId,
  @JsonKey(name: 'community_id') required int communityId,
  @JsonKey(name: 'language_id') int? languageId,
  String? body,
  String? url,
  @JsonKey(name: 'small_thumbnail_url') String? smallThumbnailUrl,
  @JsonKey(name: 'thumbnail_url') String? thumbnailUrl,
  @JsonKey(name: 'alt_text') String? altText,
  @JsonKey(name: 'image_details') WidthHeight? imageDetails,
  @JsonKey(name: 'published') required DateTime published,
  DateTime? updated,
  @JsonKey(name: 'ai_generated', defaultValue: false) required bool aiGenerated,
  bool? sticky,
  @JsonKey(name: 'instance_sticky') bool? instanceSticky,
  bool? locked,
  @JsonKey(name: 'post_type') PostType? postType,
  PostPoll? poll,
  PostEvent? event,
  @JsonKey(name: 'emoji_reactions') List<Reactions>? emojiReactions,
  @JsonKey(name: 'cross_posts') List<MiniCrossPosts>? crossPosts,
  String? tags,
  String? flair,
}) = _Post;