deleteMessagse method

dynamic deleteMessagse(
  1. String messageId
)

to delete a message, call this function

Implementation

deleteMessagse(String messageId) async {
  customPrint('dsfsdf  ....$chatId....\n$messageId');

  await chatCollectionReference
      .doc(chatId)
      // .doc(getSessionId(userId))
      .collection('messages')
      .doc(messageId)
      .delete();
  try {
    String messageString = HS.chatFilesBox.get(chatId);
    Map messages = jsonDecode(messageString);
    messages.remove(messageId);
    await HS.chatFilesBox.put(chatId, jsonEncode(messages));
  } catch (e) {
    customPrint('Error in catch block in deleting the message $e');
  }
}