fromEntity static method
Implementation
static Future<MemberCartModel?> fromEntity(
String documentID, MemberCartEntity? entity) async {
if (entity == null) return null;
var counter = 0;
return MemberCartModel(
documentID: documentID,
appId: entity.appId ?? '',
cartItems: entity.cartItems == null
? null
: List<CartItemModel>.from(
await Future.wait(entity.cartItems!.map((item) {
counter++;
return CartItemModel.fromEntity(counter.toString(), item);
}).toList())),
);
}