fromMap method
Implementation
FPayPalShippingInfo fromMap(Map<String, dynamic> data) {
//the data is saved in result key
MapHelper _c = MapHelper()..setMap(data);
String result = _c.getString("result");
Map<String, dynamic>? jsonRes;
try {
jsonRes = jsonDecode(result);
} catch (_) {}
setMap(jsonRes ?? {});
payToken = getString("payToken");
Map<String, dynamic>? shippingChangeAddress2 = getMap(
"shippingChangeAddress",
);
shippingChangeAddress = FPayPalShippingChangeAddress().fromMap(
shippingChangeAddress2 ?? {},
);
List<dynamic>? options2 = getList('shippingOptions');
if (options2 != null) {
for (var opt in options2) {
shippingOptions.add(FPayPalShippingOptions().fromMap(opt));
}
}
_shipingChangeType = getString("shippingChangeType");
if (_shipingChangeType == "address_change") {
shippingChangeType = ShippingChangeType.addressChange;
} else if (_shipingChangeType == "option_change") {
shippingChangeType = ShippingChangeType.optionChange;
}
return this;
}