toMap method

Map<String, dynamic> toMap()

Implementation

Map<String, dynamic> toMap() {
  return {
    'name': 'PRODUCT_VIEW', // PRODUCT_VIEW is required
    'productId': productId,
    if (title != null && title != '') 'title': title,
    if (url != null && url != '') 'url': url,
    if (mUrl != null && mUrl != '') 'mUrl': mUrl,
    if (image != null && image != '') 'image': image,
    if (imageXS != null && imageXS != '') 'imageXS': imageXS,
    if (imageS != null && imageS != '') 'imageS': imageS,
    if (imageM != null && imageM != '') 'imageM': imageM,
    if (imageL != null && imageL != '') 'imageL': imageL,
    if (imageXL != null && imageXL != '') 'imageXL': imageXL,
    if (additionalImages != null) 'additionalImages': additionalImages,
    if (mainCategory != null) 'mainCategory': mainCategory,
    if (category != null && category != '') 'category': category,
    if (categories != null) 'categories': categories,
    if (price != null && price != 0.0) 'price': price,
    if (oldPrice != null && oldPrice != 0.0) 'oldPrice': oldPrice,
    if (specialPrice != null && specialPrice != 0.0) 'specialPrice': specialPrice,
    if (lastUpdateTime != null) 'lastUpdateTime': lastUpdateTime,
    if (inStock != null) 'inStock': inStock,
    if (stockCount != null && stockCount != 0) 'stockCount': stockCount,
    if (stockRatio != null && stockRatio != 0.0) 'stockRatio': stockRatio,
    if (stockStatus != null && stockStatus != 0.0) 'stockStatus': stockStatus,
    if (brand != null && brand != '') 'brand': brand,
    if (gender != null && gender != '') 'gender': gender,
    if (labels != null) 'labels': labels,
    if (sizes != null) 'sizes': sizes,
    if (allSizes != null) 'allSizes': allSizes,
    if (colors != null) 'colors': colors,
    if (publishTime != null) 'publishTime': publishTime,
    if (source != null && source != '') 'source': source,
    if (noUpdate != null) 'noUpdate': noUpdate,
    if (activeBanners != null) 'activeBanners': activeBanners,
    if (groupId != null && groupId != '') 'groupId': groupId,
    if (scoreCount != null && scoreCount != 0.0) 'scoreCount': scoreCount,
    if (reviewCount != null && reviewCount != 0) 'reviewCount': reviewCount,
    if (subSource != null && subSource != '') 'subSource': subSource,
    if (paramsList != null) 'paramsList': paramsList,
    'sessionId': sessionId,
    'userId': userId,
    'device': device,
    'os': os,
    'lang': lang,
  };
}