deleteConversation method

Future<void> deleteConversation(
  1. String id
)

Implementation

Future<void> deleteConversation(String id) async {
  try {
    final response = await _conversationRepository.deleteConversation(id);

    if (response.status == 'success') {
      //log(response.toString());
      getAllConversations();
      _loadingService.showInfo('conversation deleted');
      update();
    }
  } catch (e) {
    if (e is DioError) {
      _loadingService.showError(e.response?.data['message'] ??
          'Error: Unable to delete conversation');
    } else {
      _loadingService.showError(
        'Error: unable to delete conversation...',
      );
    }
    //log(e.toString());
  }
}