sendMessage method
Implementation
Future<void> sendMessage(String dialogId,
{String? body,
List<QBAttachment>? attachments,
Map<String, String>? properties,
bool markable = false,
bool? saveToHistory}) async {
Map<String, Object> data = Map();
data["dialogId"] = dialogId;
data["markable"] = markable;
if (body != null) {
data["body"] = body;
}
if (attachments != null && attachments.length > 0) {
List<Map<String, Object>?> attachmentMapList = [];
for (final attachment in attachments) {
Map<String, Object>? attachmentMap = QBAttachmentMapper.qbAttachmentToMap(attachment);
attachmentMapList.add(attachmentMap);
}
data["attachments"] = attachmentMapList;
}
if (properties != null && properties.length > 0) {
data["properties"] = properties;
}
if (saveToHistory != null) {
data["saveToHistory"] = saveToHistory;
}
await _chatModule.invokeMethod(SEND_MESSAGE_METHOD, data);
}