downvote method

Future<void> downvote(
  1. String requestId
)

Implementation

Future<void> downvote(String requestId) async {
  final userId = await userService.getUserId();

  final response = await http.delete(
    Uri.parse('${apiUrl}votes/$requestId/$userId'),
    headers: {
      'api-key': apiKey,
      'user-id': userId,
      "Content-Type": "application/json",
      "Accept": "application/json",
    },
  );

  log(response.body);
  log(response.statusCode.toString());

  if (response.statusCode == 200) {
    return;
  } else {
    throw Exception('Failed to downvote');
  }
}