toDocument method

  1. @override
Map<String, Object?> toDocument()
override

Implementation

@override
Map<String, Object?> toDocument() {
  final List<Map<String?, dynamic>>? imagesListMap = images != null
      ? images!.map((item) => item.toDocument()).toList()
      : null;
  final Map<String, dynamic>? posSizeMap =
      posSize != null ? posSize!.toDocument() : null;

  Map<String, Object?> theDocument = HashMap();
  if (appId != null) {
    theDocument["appId"] = appId;
  } else {
    theDocument["appId"] = null;
  }
  if (title != null) {
    theDocument["title"] = title;
  } else {
    theDocument["title"] = null;
  }
  if (about != null) {
    theDocument["about"] = about;
  } else {
    theDocument["about"] = null;
  }
  if (price != null) {
    theDocument["price"] = price;
  } else {
    theDocument["price"] = null;
  }
  if (weight != null) {
    theDocument["weight"] = weight;
  } else {
    theDocument["weight"] = null;
  }
  if (shopId != null) {
    theDocument["shopId"] = shopId;
  } else {
    theDocument["shopId"] = null;
  }
  if (images != null) {
    theDocument["images"] = imagesListMap;
  } else {
    theDocument["images"] = null;
  }
  if (posSize != null) {
    theDocument["posSize"] = posSizeMap;
  } else {
    theDocument["posSize"] = null;
  }
  return theDocument;
}