fromMap static method

CartEntity? fromMap(
  1. Object? o, {
  2. Map<String, String>? newDocumentIds,
})

Implementation

static CartEntity? fromMap(Object? o, {Map<String, String>? newDocumentIds}) {
  if (o == null) return null;
  var map = o as Map<String, dynamic>;

  var itemImageBackgroundFromMap = map['itemImageBackground'];
  if (itemImageBackgroundFromMap != null) {
    itemImageBackgroundFromMap = BackgroundEntity.fromMap(
        itemImageBackgroundFromMap,
        newDocumentIds: newDocumentIds);
  }
  var itemDetailBackgroundFromMap = map['itemDetailBackground'];
  if (itemDetailBackgroundFromMap != null) {
    itemDetailBackgroundFromMap = BackgroundEntity.fromMap(
        itemDetailBackgroundFromMap,
        newDocumentIds: newDocumentIds);
  }
  var checkoutActionFromMap = map['checkoutAction'];
  if (checkoutActionFromMap != null) {
    checkoutActionFromMap = ActionEntity.fromMap(checkoutActionFromMap,
        newDocumentIds: newDocumentIds);
  }
  var backToShopActionFromMap = map['backToShopAction'];
  if (backToShopActionFromMap != null) {
    backToShopActionFromMap = ActionEntity.fromMap(backToShopActionFromMap,
        newDocumentIds: newDocumentIds);
  }
  var openProductActionFromMap = map['openProductAction'];
  if (openProductActionFromMap != null) {
    openProductActionFromMap = ActionEntity.fromMap(openProductActionFromMap,
        newDocumentIds: newDocumentIds);
  }
  var conditionsFromMap = map['conditions'];
  if (conditionsFromMap != null) {
    conditionsFromMap = StorageConditionsEntity.fromMap(conditionsFromMap,
        newDocumentIds: newDocumentIds);
  }

  return CartEntity(
    appId: map['appId'],
    title: map['title'],
    description: map['description'],
    checkoutText: map['checkoutText'],
    shopId: map['shopId'],
    itemImageBackground: itemImageBackgroundFromMap,
    itemDetailBackground: itemDetailBackgroundFromMap,
    checkoutAction: checkoutActionFromMap,
    backToShopAction: backToShopActionFromMap,
    openProductAction: openProductActionFromMap,
    conditions: conditionsFromMap,
  );
}