sendMessage method

void sendMessage()

Implementation

void sendMessage() async {
  if (state is ReadyToSendState) {
    // ReadyToSendState readtState = state;
    var text = textController.text;
    textController.clear();
    emit(InputEmptyState());

    var docReference = activityRepository.createActivityReference();

    activityRepository.setTyping(userId, false);
    ActivityLog activity = TextActivity(documentId: docReference.id, userId: userId, text: text);
    activityRepository.addActivity(docReference, activity);

    scrollController?.animateTo(0.0, duration: Duration(milliseconds: 300), curve: Curves.easeOut);
  }
}