toInteractiveMessage method

InteractiveMessage toInteractiveMessage()

Converts the FormMessage to an InteractiveMessage.

Implementation

InteractiveMessage toInteractiveMessage() {
  List<Map<String, dynamic>> formFieldMap = [];
  for (var element in formFields) {
    formFieldMap.add(element.toMap());
  }
  interactiveData[ModelFieldConstants.formFields] = formFieldMap;

  interactiveData[ModelFieldConstants.submitElement] = submitElement.toMap();
  if (Utils.isValidString(title)) {
    interactiveData[ModelFieldConstants.title] = title;
  }
  if (Utils.isValidString(goalCompletionText)) {
    interactiveData[ModelFieldConstants.goalCompletionText] =
        goalCompletionText;
  }

  return this;
}