reportConversation method

Future<void> reportConversation(
  1. String id
)

Implementation

Future<void> reportConversation(String id) async {
  final request = ReportContactRequest(
    contactUid: id,
    reason: reportConversationsController.text,
  );
  _loadingService.show();
  try {
    final response =
        await _conversationRepository.reportConversation(request);
    if (response.status == 'success') {
      getAllConversations();

      _loadingService.dismiss();
      reportConversationsController.clear();
      Get.bottomSheet(ReportReceivedBottomSheet(
        conversationId: id,
      ));
    }
  } catch (e) {
    if (e is DioError) {
      //log(e.response.toString());
      _loadingService.showError(
        'Error: unable to report conversation...',
      );
    } else {
      _loadingService.showError(
        'Error: unable to report conversation...',
      );
      //log(e.toString());
    }
  }
}