BaseMessage constructor
BaseMessage(- {required String message,
- required SendingStatus? sendingStatus,
- required String channelUrl,
- required ChannelType channelType,
- Sender? sender,
- List<User> mentionedUsers = const <User>[],
- String? requestId,
- int messageId = 0,
- MentionType? mentionType,
- bool isReplyToChannel = false,
- int createdAt = 0,
- int updatedAt = 0,
- int? parentMessageId,
- Map<String, dynamic>? parentMessage,
- ThreadInfo? threadInfo,
- List<MessageMetaArray>? allMetaArrays,
- String? customType,
- int? messageSurvivalSeconds,
- bool forceUpdateLastMessage = false,
- bool isSilent = false,
- int? errorCode,
- bool isOperatorMessage = false,
- String? data,
- OGMetaData? ogMetaData,
- List<Reaction>? reactions = const <Reaction>[],
- ScheduledInfo? scheduledInfo,
- 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;
}
}
}