fromEntityPlus static method
Future<ProductDisplayModel?>
fromEntityPlus(
- String documentID,
- ProductDisplayEntity? entity, {
- String? appId,
Implementation
static Future<ProductDisplayModel?> fromEntityPlus(
String documentID, ProductDisplayEntity? 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 ProductDisplayModel(
documentID: documentID,
appId: entity.appId ?? '',
description: entity.description,
itemDetailBackground: await BackgroundModel.fromEntityPlus(
entity.itemDetailBackground,
appId: appId),
addToBasketText: entity.addToBasketText,
buyAction:
await ActionModel.fromEntityPlus(entity.buyAction, appId: appId),
shop: shopHolder,
background:
await BackgroundModel.fromEntityPlus(entity.background, appId: appId),
conditions: await StorageConditionsModel.fromEntityPlus(entity.conditions,
appId: appId),
);
}