fromEntity static method

Future<ShopFrontModel?> fromEntity(
  1. String documentID,
  2. ShopFrontEntity? entity
)

Implementation

static Future<ShopFrontModel?> fromEntity(
    String documentID, ShopFrontEntity? entity) async {
  if (entity == null) return null;
  return ShopFrontModel(
    documentID: documentID,
    appId: entity.appId ?? '',
    title: entity.title,
    description: entity.description,
    size: entity.size,
    cardElevation: entity.cardElevation,
    cardAxisSpacing: entity.cardAxisSpacing,
    itemCardBackground:
        await BackgroundModel.fromEntity(entity.itemCardBackground),
    addToCartColor: await RgbModel.fromEntity(entity.addToCartColor),
    scrollDirection: toScrollDirection(entity.scrollDirection),
    buyAction: await ActionModel.fromEntity(entity.buyAction),
    openProductAction: await ActionModel.fromEntity(entity.openProductAction),
    padding: await EdgeInsetsGeometryModel.fromEntity(entity.padding),
    conditions: await StorageConditionsModel.fromEntity(entity.conditions),
  );
}