fromEntityPlus static method
Future<ShopFrontModel?>
fromEntityPlus(
- String documentID,
- ShopFrontEntity? entity, {
- String? appId,
Implementation
static Future<ShopFrontModel?> fromEntityPlus(
String documentID, ShopFrontEntity? entity,
{String? appId}) async {
if (entity == null) return null;
ShopModel? shopHolder;
if (entity.shopId != null) {
try {
shopHolder = await shopRepository(appId: appId)!.get(entity.shopId);
} on Exception catch (e) {
print('Error whilst trying to initialise shop');
print('Error whilst retrieving shop with id ${entity.shopId}');
print('Exception: $e');
}
}
return ShopFrontModel(
documentID: documentID,
appId: entity.appId ?? '',
title: entity.title,
description: entity.description,
shop: shopHolder,
size: entity.size,
cardElevation: entity.cardElevation,
cardAxisSpacing: entity.cardAxisSpacing,
itemCardBackground: await BackgroundModel.fromEntityPlus(
entity.itemCardBackground,
appId: appId),
addToCartColor:
await RgbModel.fromEntityPlus(entity.addToCartColor, appId: appId),
scrollDirection: toScrollDirection(entity.scrollDirection),
buyAction:
await ActionModel.fromEntityPlus(entity.buyAction, appId: appId),
openProductAction: await ActionModel.fromEntityPlus(
entity.openProductAction,
appId: appId),
padding: await EdgeInsetsGeometryModel.fromEntityPlus(entity.padding,
appId: appId),
conditions: await StorageConditionsModel.fromEntityPlus(entity.conditions,
appId: appId),
);
}