createVote method

  1. @override
Future<CreateVote> createVote({
  1. required String distinctId,
  2. required String targetId,
  3. required String category,
  4. bool? toggle,
})
override

Implementation

@override
Future<CreateVote> createVote({required String distinctId, required String targetId, required String category, bool? toggle}) async {
  final response = await dio.post(
    '/votes',
    data: {
      'api_key': Environment.apiKey,
      'campaign': Environment.campaign,
      'distinct_id': distinctId,
      'target_id': targetId,
      'category': category,
      'toggle': toggle,
    }
  );
  final Map<String, dynamic> responseData = _parseResponse(response.data);
  return _jsonToCreateVote(responseData);
}