fromMap static method

MemberCartEntity? fromMap(
  1. Object? o, {
  2. Map<String, String>? newDocumentIds,
})

Implementation

static MemberCartEntity? fromMap(Object? o,
    {Map<String, String>? newDocumentIds}) {
  if (o == null) return null;
  var map = o as Map<String, dynamic>;

  var cartItemsFromMap = map['cartItems'];
  List<CartItemEntity> cartItemsList;
  if (cartItemsFromMap != null) {
    cartItemsList = (map['cartItems'] as List<dynamic>)
        .map((dynamic item) => CartItemEntity.fromMap(item as Map,
            newDocumentIds: newDocumentIds)!)
        .toList();
  } else {
    cartItemsList = [];
  }

  return MemberCartEntity(
    appId: map['appId'],
    cartItems: cartItemsList,
  );
}