fetchDisplayAdsWithPt method

  1. @override
Future<Map<String, dynamic>?> fetchDisplayAdsWithPt({
  1. required String cliUbid,
  2. required String pageType,
  3. required int productCount,
  4. List<TargetingParams>? targetingParams,
})
override

Fetches display ads using page type.

Parameters:

  • cliUbid: Unique user identifier.
  • pageType: Type of the page where the ads will be displayed.
  • productCount: Number of products.
  • targetingParams: Map of targeting options (optional).
  • extra_params: Additional optional parameters (optional).

Returns: A Future resolving to a Map<String, dynamic>? containing ad data or null if unavailable.

Example Usage:


var response = await AdFetcher.fetchDisplayAdsWithPt(
          cliUbid: "your_user_id",
          pageType: "your_page_type",
          productCount: 10,
          targetingParams: {"f.keyword": "your_filter"},
          extra_params: {});

Implementation

@override
Future<Map<String, dynamic>?> fetchDisplayAdsWithPt({
  required String cliUbid,
  required String pageType,
  required int productCount,
  List<TargetingParams>? targetingParams,
}) async {
  final result = await MethodHandler.invokeNativeMethod(
      'fetchDisplayAdsWithPt',
      arguments: {
        "cliUbid": cliUbid,
        "pageType": pageType,
        "productCount": productCount,
        "targetingParams": convertTargetingParamsToMapList(targetingParams),
      });
  return Map<String, dynamic>.from(result ?? {});
}