BaseMessage constructor

BaseMessage({
  1. Map<String, dynamic>? parentMessage,
  2. required bool isPinnedMessage,
  3. String? requestId,
  4. int messageId = 0,
  5. required String message,
  6. required MessageSendingStatus? sendingStatus,
  7. Sender? sender,
  8. required String channelUrl,
  9. required ChannelType channelType,
  10. List<User> mentionedUsers = const <User>[],
  11. MentionType? mentionType,
  12. List<String>? mentionedUserIds = const <String>[],
  13. List<String>? requestedMentionUserIds,
  14. int createdAt = 0,
  15. int updatedAt = 0,
  16. bool replyToChannel = false,
  17. int? parentMessageId,
  18. String? parentMessageText,
  19. ThreadInfo? threadInfo,
  20. List<MessageMetaArray>? metaArrays,
  21. String? customType,
  22. int? messageSurvivalSeconds,
  23. bool forceUpdateLastMessage = false,
  24. bool isSilent = false,
  25. int? errorCode,
  26. bool isOperatorMessage = false,
  27. String? data,
  28. OGMetaData? ogMetaData,
  29. List<Reaction>? reactions = const <Reaction>[],
  30. ScheduledInfo? scheduledInfo,
  31. Map<String, dynamic> extendedMessage = const {},
})

default constructor

Implementation

BaseMessage({
  Map<String, dynamic>? parentMessage,
  required this.isPinnedMessage,
  this.requestId,
  this.messageId = 0,
  required this.message,
  required this.sendingStatus,
  this.sender,
  required this.channelUrl,
  required this.channelType,
  this.mentionedUsers = const <User>[],
  this.mentionType,
  this.mentionedUserIds = const <String>[],
  this.requestedMentionUserIds,
  this.createdAt = 0,
  this.updatedAt = 0,
  this.replyToChannel = false,
  this.parentMessageId,
  this.parentMessageText,
  this.threadInfo,
  this.metaArrays,
  this.customType,
  this.messageSurvivalSeconds,
  this.forceUpdateLastMessage = false,
  this.isSilent = false,
  this.errorCode,
  this.isOperatorMessage = false,
  this.data,
  this.ogMetaData,
  this.reactions = const <Reaction>[],
  this.scheduledInfo,
  this.extendedMessage = const {},
}) {
  if (parentMessage != null && parentMessageId != null) {
    parentMessage['message_id'] = parentMessageId;
    parentMessage['channel_url'] = channelUrl;
    parentMessage['channel_type'] = channelType;

    this.parentMessage = BaseMessage.fromJson(parentMessage);
  }
  if (sendingStatus == null) {
    if (messageId > 0) {
      sendingStatus = MessageSendingStatus.succeeded;
    } else if (requestId != null) {
      sendingStatus = MessageSendingStatus.pending;
    } else {
      sendingStatus = MessageSendingStatus.none;
    }
  }
}