sendMessage function
Implementation
Future<void> sendMessage({
String messageText = "",
String url = '',
required String userId,
required String name,
required String profile,
}) async {
ChatMessage dummyMessage = ChatMessage(
text: messageText,
ownerId: userId,
createdOn: DateTime.now(),
ownerName: name,
ownerProfile: profile,
url: url,
);
if (messageText.isNotEmpty || url.isNotEmpty) {
DocumentReference messageRef = _chatRoomCollection.doc();
await messageRef.set(dummyMessage.toJson());
}
}