AmbulancePickDrop method
dynamic
AmbulancePickDrop({
- dynamic AddressLine1pick,
- dynamic AddressLine2pick,
- dynamic landmarkpick,
- dynamic pincodepick,
- dynamic statepick,
- dynamic citypick,
- dynamic AddressLine1drop,
- dynamic AddressLine2drop,
- dynamic landmarkdrop,
- dynamic pincodedrop,
- dynamic statedrop,
- dynamic citydrop,
- dynamic lat,
- dynamic long,
- dynamic context,
- dynamic userpackageid,
Implementation
AmbulancePickDrop(
{AddressLine1pick,
AddressLine2pick,
landmarkpick,
pincodepick,
statepick,
citypick,
AddressLine1drop,
AddressLine2drop,
landmarkdrop,
pincodedrop,
statedrop,
citydrop,
lat,
long,
context,
userpackageid}) async {
var decodedResponse;
final ApiBody = {
"vendor_name": "package",
"txt_pickup_address_1": '${AddressLine1pick}',
"txt_pickup_address_2": '${AddressLine2pick}',
"txt_pickup_landmark": '${landmarkpick}',
"txt_pickup_pincode": '${pincodepick}',
"txt_pickup_city": '${citypick}',
"txt_pickup_state": '${statepick}',
"txt_drop_address_1": '${AddressLine1drop}',
"txt_drop_address_2": '${AddressLine2drop}',
"txt_drop_landmark": '${landmarkdrop}',
"txt_drop_pincode": '${pincodedrop}',
"txt_drop_city": '${citydrop}',
"txt_drop_state": '${statedrop}',
"lat": '${lat}',
"long": '${long}',
"user_package_id": '${userpackageid}',
};
try {
http.Response response = await http.post(
Uri.parse('${SDK_BASE_URL}api/leads_request/ambulance_request'),
headers: {
"Authorization": SignUpController.currentUserToken,
},
body: ApiBody,
);
decodedResponse = json.decode(response.body);
if (decodedResponse['status'] == 200) {
Get.back();
await showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return PinCodePopUp(
messag: "${decodedResponse['message']}",
image: '${LottiePath}Order_Successful.json',
);
},
);
Get.back();
Get.back();
} else {
Get.back();
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return PinCodePopUp(
messag: "${decodedResponse['message']}",
image: '${LottiePath}Error.json',
);
},
);
}
} catch (e) {
errorListner(
apiname: 'api/leads_request/ambulance_request',
responsed: "${decodedResponse}",
request: '${ApiBody}',
app_error: '${e}');
}
}