sendTextMessage method
dynamic
sendTextMessage()
to send a text message call this function
Implementation
sendTextMessage()async{
int messageId = Timestamp.now().millisecondsSinceEpoch;
ChatModal chatModal = ChatModal(
from: currentUserId,
// to: chatId,
message: messageController.text,
messageType: MessageType.text,
createdAt: Timestamp.now(),
deliveredTo: [],
readBy: [],
reactions: {},
);
chatModal.id = messageId.toString();
chatModal.fromServer = false;
messageController.clear();
(tempChats[chatId]??{})[messageId] = chatModal;
notifyListeners();
await FirebaseChatServices(
userData: currentUserModal
).sendMessage(
chatModal,
chatId: chatId,
// notificationMessage: notificationMessage,
//
// notificationTitle: notificationTitle,
// otherUserObject: otherUserObject,
// deviceIdList: deviceIdList,
// isBlocked: isBlocked,
chatCollection: chatCollectionReference,
messageType: chatModal.messageType,
);
customLogs('Manish: removing chat id $chatId');
customPrint('sfsa ${tempChats[chatId]}');
tempChats[chatId]?.remove(messageId);
customPrint('sfsa after${tempChats[chatId]}');
notifyListeners();
}