sendMessage method

void sendMessage(
  1. ChatMessage m
)

Persists m to Firestore and notifies ChatEntity.onMessageSent.

Implementation

void sendMessage(ChatMessage m) async {
  setBusy(true);
  await chatRef?.doc().set(ChatModel.jsonFrom(m));
  setBusy(false);

  try {
    chatEntity.onMessageSent(m.text, chatEntity);
  } catch (error) {
    if (kDebugMode) {
      print("Error sending chat notification:: >> $error");
    }
  }
}