fromEntityPlus static method
Future<OrderOverviewModel?>
fromEntityPlus(
- String documentID,
- OrderOverviewEntity? entity, {
- String? appId,
Implementation
static Future<OrderOverviewModel?> fromEntityPlus(
String documentID, OrderOverviewEntity? 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 OrderOverviewModel(
documentID: documentID,
appId: entity.appId ?? '',
description: entity.description,
shop: shopHolder,
itemImageBackground: await BackgroundModel.fromEntityPlus(
entity.itemImageBackground,
appId: appId),
itemDetailBackground: await BackgroundModel.fromEntityPlus(
entity.itemDetailBackground,
appId: appId),
conditions: await StorageConditionsModel.fromEntityPlus(entity.conditions,
appId: appId),
);
}