Message constructor

Message({
  1. String? id,
  2. String? text,
  3. String type = 'regular',
  4. List<Attachment> attachments = const [],
  5. List<User> mentionedUsers = const [],
  6. bool silent = false,
  7. bool shadowed = false,
  8. Map<String, int>? reactionCounts,
  9. Map<String, int>? reactionScores,
  10. List<Reaction>? latestReactions,
  11. List<Reaction>? ownReactions,
  12. String? parentId,
  13. Message? quotedMessage,
  14. String? quotedMessageId,
  15. int? replyCount = 0,
  16. List<User>? threadParticipants,
  17. bool? showInChannel,
  18. String? command,
  19. DateTime? createdAt,
  20. DateTime? localCreatedAt,
  21. DateTime? updatedAt,
  22. DateTime? localUpdatedAt,
  23. DateTime? deletedAt,
  24. DateTime? localDeletedAt,
  25. User? user,
  26. bool pinned = false,
  27. DateTime? pinnedAt,
  28. DateTime? pinExpires,
  29. User? pinnedBy,
  30. Map<String, Object?> extraData = const {},
  31. MessageState state = const MessageState.initial(),
  32. Map<String, String>? i18n,
})

Constructor used for json serialization.

Implementation

Message({
  String? id,
  this.text,
  this.type = 'regular',
  this.attachments = const [],
  this.mentionedUsers = const [],
  this.silent = false,
  this.shadowed = false,
  this.reactionCounts,
  this.reactionScores,
  this.latestReactions,
  this.ownReactions,
  this.parentId,
  this.quotedMessage,
  String? quotedMessageId,
  this.replyCount = 0,
  this.threadParticipants,
  this.showInChannel,
  this.command,
  DateTime? createdAt,
  this.localCreatedAt,
  DateTime? updatedAt,
  this.localUpdatedAt,
  DateTime? deletedAt,
  this.localDeletedAt,
  this.user,
  this.pinned = false,
  this.pinnedAt,
  DateTime? pinExpires,
  this.pinnedBy,
  this.extraData = const {},
  this.state = const MessageState.initial(),
  this.i18n,
})  : id = id ?? const Uuid().v4(),
      pinExpires = pinExpires?.toUtc(),
      remoteCreatedAt = createdAt,
      remoteUpdatedAt = updatedAt,
      remoteDeletedAt = deletedAt,
      _quotedMessageId = quotedMessageId;