YogaMatAndBottleApi method
dynamic
YogaMatAndBottleApi({
- dynamic AddressLine1pick,
- dynamic AddressLine2pick,
- dynamic landmarkpick,
- dynamic pincodepick,
- dynamic statepick,
- dynamic citypick,
- dynamic lat,
- dynamic long,
- dynamic mobile,
- dynamic context,
- dynamic userpackageid,
- dynamic module_id,
Implementation
YogaMatAndBottleApi(
{AddressLine1pick,
AddressLine2pick,
landmarkpick,
pincodepick,
statepick,
citypick,
lat,
long,
mobile,
context,
userpackageid,
module_id}) 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}',
"lat": '${lat}',
"long": '${long}',
"mobile_no": '${mobile}',
"user_package_id": '${userpackageid}',
"module_id": '${module_id}'
};
try {
http.Response response = await http.post(
Uri.parse('${SDK_BASE_URL}api/leads_request/boat_watch_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}Upload_Successful.json',
);
},
);
await Navigator.popAndPushNamed(context, '/wellnesspage');
} else {
BackFunction(2);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return PinCodePopUp(
messag: "${decodedResponse['message']}",
image: '${LottiePath}Error.json',
);
},
);
}
} catch (e) {
errorListner(
apiname: 'api/leads_request/boat_watch_request',
responsed: "${decodedResponse}",
request: '${ApiBody}',
app_error: '${e}');
}
}