readAttachmentContent static method

Future<String?> readAttachmentContent(
  1. String idAttachment
)

Implementation

static Future<String?> readAttachmentContent(String idAttachment) async {
  try {
    String content = "";
    ChatController chatController = Get.find();
    String idConversation = chatController.conversation.value?.id ?? "";
    String idAssistant = chatController.assistant.value?.id ?? "";
    String conversationToken =
        chatController.conversation.value?.token ?? "";
    await ApiService.call(
      ApiUrls.conversationAttachmentViewUrl(
          idAssistant, idConversation, idAttachment),
      RequestType.get,
      headers: {"Conversation-Token": conversationToken},
      onSuccess: (response) => content = response.data,
      onError: (e) => showErrorSnackbar(Strings.apiErrorGeneric.tr),
    );
    return content;
  } catch (e) {
    showErrorSnackbar(Strings.apiErrorGeneric.tr);
    return null;
  }
}