void _handleSendPressed()

in frontend/frontend-flutter/lib/screens/bot.dart [237:288]


  void _handleSendPressed(types.PartialText message) {
    final textMessage = types.TextMessage(
        author: _userAvatar,
        createdAt: DateTime.now().millisecondsSinceEpoch,
        id: randomString(),
        text: message.text,
        type: types.MessageType.text,
        metadata: {"dataSource": "user"});
    bool isACannedQuestion = false;

    print('Bot : _handleSendPressed() textMessage.text = ' + textMessage.text);
    print('Bot : _handleSendPressed() textMessage.author.firstName = ' +
        textMessage.author.firstName!);

    _addMessage(textMessage);

    //Remove the welcome message after the first question asked
    if (isFirstQuestion) {
      print('Bot : _handleSendPressed() : isFirstQuestion = ' +
          isFirstQuestion.toString());
      isFirstQuestion = false;
      BlocProvider.of<FirstQuestionCubit>(context).removeWelcomeMessage();
    }

    print(
        "main: initState() : After BlocProvider.of<UpdateStepperCubit>(context).updateStepperStatusUploaded() : TextToDocParameter.lastScenarioNumber =  ${TextToDocParameter.lastScenarioNumber}");

    BlocProvider.of<NewSuggestionCubit>(context).generateNewSuggestions(
        TextToDocParameter.lastScenarioNumber, message.text,
        lastCannedQuestion: TextToDocParameter.lastCannedQuestion,
        isACannedQuestion: isACannedQuestion);

    //Update the question history on the side menu
    //BlocProvider.of<LoadQuestionCubit>(context).loadQuestionToChat(question: message.text, time: displayDateTime());
    BlocProvider.of<LoadQuestionCubit>(context)
        .loadQuestionToChat(question: message.text, time: "rr");

    //Update stepper state
    BlocProvider.of<UpdateStepperCubit>(context).updateStepperStatusUploaded(
        status: StepperStatus.enter_question,
        message: "Question entered.",
        stateStepper: StepState.complete,
        isActiveStepper: true);
    print(
        "main: initState() : After BlocProvider.of<UpdateStepperCubit>(context).updateStepperStatusUploaded() : stepper initialized");

    _handleReceivedResponse(textMessage.text, "text");

    setState(() {
      isProcessing = true;
    });
  }