fromMap static method
Implementation
static OrderEntity? fromMap(Object? o,
{Map<String, String>? newDocumentIds}) {
if (o == null) return null;
var map = o as Map<String, dynamic>;
var productsFromMap = map['products'];
List<OrderItemEntity> productsList;
if (productsFromMap != null) {
productsList = (map['products'] as List<dynamic>)
.map((dynamic item) => OrderItemEntity.fromMap(item as Map,
newDocumentIds: newDocumentIds)!)
.toList();
} else {
productsList = [];
}
return OrderEntity(
appId: map['appId'],
customerId: map['customerId'],
name: map['name'],
email: map['email'],
shipStreet1: map['shipStreet1'],
shipStreet2: map['shipStreet2'],
shipCity: map['shipCity'],
shipState: map['shipState'],
postcode: map['postcode'],
country: map['country'],
invoiceSame: map['invoiceSame'],
invoiceStreet1: map['invoiceStreet1'],
invoiceStreet2: map['invoiceStreet2'],
invoiceCity: map['invoiceCity'],
invoiceState: map['invoiceState'],
invoicePostcode: map['invoicePostcode'],
invoiceCountry: map['invoiceCountry'],
products: productsList,
totalPrice: double.tryParse(map['totalPrice'].toString()),
currency: map['currency'],
paymentReference: map['paymentReference'],
shipmentReference: map['shipmentReference'],
deliveryReference: map['deliveryReference'],
paymentNote: map['paymentNote'],
shipmentNote: map['shipmentNote'],
deliveryNote: map['deliveryNote'],
status: map['status'],
timeStamp: map['timeStamp'],
);
}