fromEntityPlus static method
Implementation
static Future<CartModel?> fromEntityPlus(
String documentID, CartEntity? 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 CartModel(
documentID: documentID,
appId: entity.appId ?? '',
title: entity.title,
description: entity.description,
checkoutText: entity.checkoutText,
shop: shopHolder,
itemImageBackground: await BackgroundModel.fromEntityPlus(
entity.itemImageBackground,
appId: appId),
itemDetailBackground: await BackgroundModel.fromEntityPlus(
entity.itemDetailBackground,
appId: appId),
checkoutAction:
await ActionModel.fromEntityPlus(entity.checkoutAction, appId: appId),
backToShopAction: await ActionModel.fromEntityPlus(
entity.backToShopAction,
appId: appId),
openProductAction: await ActionModel.fromEntityPlus(
entity.openProductAction,
appId: appId),
conditions: await StorageConditionsModel.fromEntityPlus(entity.conditions,
appId: appId),
);
}