NativeAd.fromMap constructor

NativeAd.fromMap(
  1. Map<String, dynamic> map
)

Implementation

factory NativeAd.fromMap(Map<String, dynamic> map) {
  return NativeAd(
    skuId: map['skuId'],
    name: map['name'],
    mrp: (map['mrp'] ?? 0).toDouble(),
    productUrl: map['productUrl'],
    storeId: map['storeId'] ??
        map['store_id'], // Handle both iOS (storeId) and Android (store_id)
    imageUrl: map['imageUrl'],
    videoUrl: map['videoUrl'],
    salePrice: (map['salePrice'] ?? 0).toDouble(),
    sellerId: map['sellerId'],
    itemGroupId: map['itemGroupId'],
    brand: map['brand'],
    description: map['description'],
    customLabel0: map['customLabel0'],
    customLabel1: map['customLabel1'],
    customLabel2: map['customLabel2'],
    customLabel3: map['customLabel3'],
    customLabel4: map['customLabel4'],
    uclid: map['uclid'],
    categoryL1: map['categoryL1'],
    categoryL2: map['categoryL2'],
    categoryL3: map['categoryL3'],
    adMetadata: map,
    cliUbid: map['cliUbid'],
    crt: map['crt'],
    elementsType: map['elementsType'] ?? "",
  );
}