refreshRelations static method
Implementation
static Future<OrderModel> refreshRelations(OrderModel model) async {
MemberModel? customerHolder;
if (model.customer != null) {
try {
await memberRepository(appId: model.appId)!
.get(model.customer!.documentID)
.then((val) {
customerHolder = val;
}).catchError((error) {});
} catch (_) {}
}
List<OrderItemModel>? productsHolder;
if (model.products != null) {
productsHolder = List<OrderItemModel>.from(
await Future.wait(model.products!.map((element) async {
return await OrderItemCache.refreshRelations(element);
})))
.toList();
}
return model.copyWith(
customer: customerHolder,
products: productsHolder,
);
}