ShippingOption.fromJson constructor

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

Implementation

ShippingOption.fromJson(Map<String, dynamic> json) {
  id = json['id'];
  selected = json['selected'];
  label = json['label'];
  _type = json['type'];
  if (_type == 'PICKUP') {
    type = ShippingOptionType.pickup;
  } else if (_type == 'SHIPPING') {
    type = ShippingOptionType.shipping;
  } else {
    type = ShippingOptionType.unknown;
  }
  amount =
      json['amount'] != null ? UnitAmount.fromJson(json['amount']) : null;
}