BaseMessage constructor

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

Implementation

BaseMessage({
  required this.message,
  required this.sendingStatus,
  required this.channelUrl,
  required this.channelType,
  Sender? sender,
  List<User> mentionedUsers = const <User>[],
  this.requestId,
  this.messageId = 0,
  this.mentionType,
  this.isReplyToChannel = false,
  this.createdAt = 0,
  this.updatedAt = 0,
  this.parentMessageId,
  Map<String, dynamic>? parentMessage,
  this.threadInfo,
  this.allMetaArrays,
  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 {},
})  : _sender = sender,
      _mentionedUsers = mentionedUsers {
  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 = SendingStatus.succeeded;
    } else if (requestId != null) {
      sendingStatus = SendingStatus.pending;
    } else {
      sendingStatus = SendingStatus.none;
    }
  }
}