getAdsByLanguage method

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

Retrieves a list of advertisements by language from the API.

The language parameter specifies the language of the ads to be fetched. Optionally, you can specify the maximum number of ads to be returned with the limit parameter. Returns a list of FastResponseAd objects that match the given criteria.

Implementation

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

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

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