ShippingMethod.fromJson constructor

ShippingMethod.fromJson(
  1. Map<String, dynamic> json
)

Implementation

ShippingMethod.fromJson(Map<String, dynamic> json) {
  id = json['id'];
  selected = json['selected'];
  label = json['label'];
  _type = json['type'];
  if (_type == 'SHIPPING') {
    type = ShippingMethodType.shipping;
  } else if (_type == 'PICKUP') {
    type = ShippingMethodType.pickup;
  } else if (_type == 'SHIPPING_AND_PICKUP') {
    type = ShippingMethodType.shippingAndPickup;
  } else {
    type = ShippingMethodType.none;
  }
  amount = json['amount'] != null ? UnitPrice.fromJson(json['amount']) : null;
}