shipping_zones method

dynamic shipping_zones({
  1. int? id,
})

Implementation

shipping_zones({
  int? id,
}) async {
  Response res;
  String? request_api = 'shipping/zones';
  if (id != null) {
    request_api = '$request_api/$id';
  }

  res = await ApiServices()
      .getRequest(request_api, baseUrl, consumerKey, consumerSecret);
  var decoded_data = json.decode(res.body);
  List<ShippingZoneModel> parsed_list = [];
  for (var i = 0; i < decoded_data.length; i++) {
    ShippingZoneModel parse_data =
        ShippingZoneModel.fromJson(decoded_data[i]);
    parsed_list.add(parse_data);
  }
  return parsed_list;
}