getAdsByCountryAndLanguage method

Future<List<FastResponseAd>> getAdsByCountryAndLanguage(
  1. String country,
  2. String language, {
  3. String? appId,
  4. String? providerId,
  5. int? limit,
})

Retrieves a list of advertisements by country and language from the API.

The country and language parameters specify the country and language of the ads to be fetched. Optionally, you can specify the appId, providerId, and limit parameters to filter the results. Returns a list of FastResponseAd objects that match the given criteria.

Implementation

Future<List<FastResponseAd>> getAdsByCountryAndLanguage(
  String country,
  String language, {
  String? appId,
  String? providerId,
  int? limit,
}) async {
  final cachedAds = await _getCachedAds(
    language,
    providerId: providerId,
    country: country,
    appId: appId,
    limit: limit,
  );

  if (cachedAds != null && cachedAds.isNotEmpty) {
    return cachedAds;
  }

  return _fetchAds(
    language,
    providerId: providerId,
    country: country,
    appId: appId,
    limit: limit,
  );
}