getGoalsIndex method

  1. @override
Future<List<IndexGoals>> getGoalsIndex({
  1. required bool enabled,
  2. required List<String> tags,
  3. num? page,
  4. num? limit,
  5. String? sponsorId,
  6. bool? trending,
  7. String? q,
})
override

Implementation

@override
Future<List<IndexGoals>> getGoalsIndex({
  required bool enabled,
  required List<String> tags,
  num? page,
  num? limit,
  String? sponsorId,
  bool? trending,
  String? q,
}) async {
  final response = await dio.post(
    '/goals/index',
    data: {
      'api_key': Environment.apiKey,
      'campaign': Environment.campaign,
      'enabled': enabled,
      'tags': tags,
      'page': ?page,
      'limit': ?limit,
      'sponsor_id': ?sponsorId,
      'trending': ?trending,
      'q': ?q,
    },
  );
  final Map<String, dynamic> responseData = jsonDecode(response.data);
  return _goalsIndexFromResponse(responseData);
}